Update src/app.py
Browse files- src/app.py +62 -61
src/app.py
CHANGED
|
@@ -511,7 +511,7 @@ div.element-container:has(.action-marker.log) + div button:hover { color: #AA
|
|
| 511 |
}
|
| 512 |
.pca-icon:hover { color: #AAAAAA; background: rgba(255,255,255,0.09); }
|
| 513 |
.pca-icon-del:hover { color: #CC5555 !important; background: rgba(180,60,60,0.12) !important; }
|
| 514 |
-
/* PCATRIGGER ์จ๊ธด ๋ฒํผ
|
| 515 |
/* โโ ํฌํธํด๋ฆฌ์ค ์นด๋ ๋ฒํผํ: ์นด๋ HTML ๋ฐ๋ก ์๋ ๋ถ์ด๊ธฐ */
|
| 516 |
.port-card-btn-row {
|
| 517 |
background: linear-gradient(135deg, #161616 0%, #0E0E0E 100%);
|
|
@@ -684,10 +684,10 @@ def select_menu(name):
|
|
| 684 |
st.session_state.pop(k, None)
|
| 685 |
|
| 686 |
st.button("โฌข INVEST PRO ALPHA", key="header_logo_btn", help="header_logo", on_click=go_home)
|
| 687 |
-
# pca_trigger ์จ๊ธด ๋ฒํผ
|
| 688 |
st.button("PCATRIGGER", key="pca_trigger_btn")
|
| 689 |
|
| 690 |
-
# โโ pca_action query param ์ฒ๋ฆฌ (์นด๋ ์์ด์ฝ ๋ฒํผ
|
| 691 |
_pca = st.query_params.get("pca_action", "")
|
| 692 |
if _pca:
|
| 693 |
from urllib.parse import unquote
|
|
@@ -838,7 +838,7 @@ def get_ai_json_response(prompt, bypass_cache=False):
|
|
| 838 |
"summary": f"๋ชจ๋ ๋ชจ๋ธ ์๋ต ์คํจ. ์ ์ ํ ์ฌ์๋ํด ์ฃผ์ธ์. ({err_summary})",
|
| 839 |
"recommendation_stars": "๋ถ์๋ถ๊ฐ",
|
| 840 |
"confidence_score": 0,
|
| 841 |
-
"confidence_reason": f"API ์ค๋ฅ๋ก ๋ถ์ ๋ถ๊ฐ
|
| 842 |
}
|
| 843 |
)
|
| 844 |
|
|
@@ -1076,12 +1076,12 @@ def _build_portfolio_context(prices, rate):
|
|
| 1076 |
rp = st.session_state.full_stock_reports.get(f"{t}_{ap}", {}).get("report", {})
|
| 1077 |
act = rp.get("action_type", "๋ฏธ๋ถ์")
|
| 1078 |
lines.append(
|
| 1079 |
-
f" ยท {row['์ข
๋ชฉ๋ช
']}({t}): ํ๋จ {int(ap):,}์
|
| 1080 |
f"({pct:+.1f}%), ์๋ {qty}์ฃผ, ์ ๋ตํ์ [{act}]"
|
| 1081 |
)
|
| 1082 |
port_pct = (total_val / total_cost - 1) * 100 if total_cost > 0 else 0
|
| 1083 |
header = (
|
| 1084 |
-
f"[๋ด ํฌํธํด๋ฆฌ์ค ํํฉ
|
| 1085 |
f" ์ด ํฌ์์๊ธ: {int(total_cost):,}์ / ์ด ํ๊ฐ์ก: {int(total_val):,}์ / "
|
| 1086 |
f"์ ์ฒด ์์ต๋ฅ : {port_pct:+.1f}%\n"
|
| 1087 |
f" ๋ณด์ ์ข
๋ชฉ ({len(lines)}๊ฐ):\n"
|
|
@@ -1199,7 +1199,7 @@ for k, v in [('p_diag_mode', False), ('price_cache', {}), ('price_cache_ts', 0.0
|
|
| 1199 |
def save_assets():
|
| 1200 |
st.session_state.df.to_csv(DB_FILE, index=False); _hf_ul(DB_FILE)
|
| 1201 |
|
| 1202 |
-
# pca_del ํ๋๊ทธ ์ฒ๋ฆฌ (query param
|
| 1203 |
if "_pca_del_idx" in st.session_state and "df" in st.session_state:
|
| 1204 |
_di = st.session_state.pop("_pca_del_idx")
|
| 1205 |
if _di in st.session_state.df.index:
|
|
@@ -1228,7 +1228,7 @@ def save_cache():
|
|
| 1228 |
# AI ํ๋กฌํํธ
|
| 1229 |
# ============================================================
|
| 1230 |
INVESTOR_PROFILE = """
|
| 1231 |
-
[ํฌ์์ ํ๋กํ
|
| 1232 |
- ํฌ์ ์ฑํฅ: ์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ํฌ์์ (6๊ฐ์ ์ด์ ๋ณด์ ์์น)
|
| 1233 |
- ์ ํธ ์ข
๋ชฉ: ์ฑ์ฅํ ์ฃผ์, ํด์ด๋ผ์ด๋ ์ฃผ์, ๊ธฐ์ ์ฃผ
|
| 1234 |
- ๋ฆฌ์คํฌ ํ์ฉ๋: ์ค๊ฐ~๋์ (์ฑ์ฅ๊ณผ ํด์ด๋ผ์ด๋๋ฅผ ์ํ ๋ฆฌ์คํฌ๋ ์์ฉ)
|
|
@@ -1240,9 +1240,9 @@ def get_scan_prompt(target, tid="", owned=None, news=None, portfolio_context="")
|
|
| 1240 |
owned_s = ", ".join(owned) if owned else "์์"
|
| 1241 |
date_s = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 1242 |
news_s = ""
|
| 1243 |
-
if news: news_s = "\n[์ต๊ทผ ๋ด์ค
|
| 1244 |
port_s = f"\n{portfolio_context}" if portfolio_context else ""
|
| 1245 |
-
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ถ์ ์ ๋ฌธ๊ฐ
|
| 1246 |
{INVESTOR_PROFILE}
|
| 1247 |
[๋ถ์ ๋ชฉ์ ]
|
| 1248 |
์ด ํฌ์์์ ํ์ฌ ํฌํธํด๋ฆฌ์ค ์ํฉ๊ณผ ๊ธฐ๋ณด์ ์ข
๋ชฉ์ ๋จผ์ ํ์
ํ ๋ค,
|
|
@@ -1255,18 +1255,18 @@ def get_scan_prompt(target, tid="", owned=None, news=None, portfolio_context="")
|
|
| 1255 |
4. ๊ฐ ํญ๋ชฉ๋ง๋ค ๊ทผ๊ฑฐ ๋ฐ์ดํฐ 1๊ฐ ์ด์ ๋ช
์.
|
| 1256 |
5. ์์ JSON๋ง ์ถ๋ ฅ. ๋งํฌ๋ค์ด ๊ธฐํธ ๊ธ์ง.
|
| 1257 |
6. ์ ๋(์ซ์) ๊ทผ๊ฑฐ์ ์ ์ฑ(ํ๋จ) ๊ทผ๊ฑฐ๋ฅผ ๋ฐ๋์ ๋ถ๋ฆฌํด์ ์ ์.
|
| 1258 |
-
7. ํฌํธํด๋ฆฌ์ค ๋งฅ๋ฝ์ ๋ฐ๋์ ๋ฐ์
|
| 1259 |
{news_s}
|
| 1260 |
[๋ถ์ ๋์ ์ข
๋ชฉ ๋ฐ์ดํฐ]
|
| 1261 |
{target}
|
| 1262 |
-
[์ด๋ฏธ ๋ณด์ ์ค์ธ ์ข
๋ชฉ
|
| 1263 |
[์ถ๋ ฅ JSON ํ์]
|
| 1264 |
{{
|
| 1265 |
"recommendation_stars": "โ
โ
โ
โ
โ",
|
| 1266 |
-
"summary": "ํ ์ค ์์ฝ
|
| 1267 |
"action_type": "๋งค์/๊ด๋ง/์ ์ธ ์ค ํ๋",
|
| 1268 |
"confidence_score": 0,
|
| 1269 |
-
"confidence_reason": "์ ๋ขฐ๋ ๊ทผ๊ฑฐ
|
| 1270 |
"portfolio_fit": {{
|
| 1271 |
"sector_overlap": "๊ธฐ๋ณด์ ์ข
๋ชฉ๊ณผ์ ์นํฐ/ํ
๋ง ์ค๋ณต ์ฌ๋ถ",
|
| 1272 |
"risk_diversification": "ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ๋ถ์ฐ์ ๊ธฐ์ฌํ๋๊ฐ",
|
|
@@ -1274,25 +1274,25 @@ def get_scan_prompt(target, tid="", owned=None, news=None, portfolio_context="")
|
|
| 1274 |
}},
|
| 1275 |
"growth_moat_quantitative": "์ ๋ ๊ทผ๊ฑฐ (2~3๋ฌธ์ฅ)",
|
| 1276 |
"growth_moat_qualitative": "์ ์ฑ ๊ทผ๊ฑฐ (2~3๋ฌธ์ฅ, ์ฑ์ฅ์ฃผ/ํด์ด๋ผ์ด๋ ๊ตฌ๋ถ ๋ช
์)",
|
| 1277 |
-
"timing_entry_analysis": "์ค์ฅ๊ธฐ ์ง์
ํ์ด๋ฐ ๋ถ์ (2~3๋ฌธ์ฅ)
|
| 1278 |
"entry_zones": {{
|
| 1279 |
"first_buy": "1์ฐจ ๋ถํ ๋งค์ ์ ์ ๊ฐ๊ฒฉ๋ (์ํ)",
|
| 1280 |
"second_buy": "2์ฐจ ์ถ๊ฐ๋งค์ ๊ฐ๊ฒฉ๋ (์ํ)",
|
| 1281 |
"stop_thesis": "์ด ๊ฐ๊ฒฉ/์กฐ๊ฑด์ด๋ฉด ์ฑ์ฅ ์คํ ๋ฆฌ ๋ถ๊ดด"
|
| 1282 |
}},
|
| 1283 |
"valuation_growth_fit": "์ฑ์ฅ๋ฅ ๋๋น ๋ฐธ๋ฅ์์ด์
ํ๋จ (2~3๋ฌธ์ฅ)",
|
| 1284 |
-
"tech_risk_hedge": "๊ธฐ์ ์ฃผ ์ง์ค ๋ฆฌ์คํฌ ๋ฐ ํค์ง ์กฐ์ธ
|
| 1285 |
"catalyst": "์ง๊ธ ํฌ์ํด์ผ ํ ๊ตฌ์ฒด์ ์ด๋งค",
|
| 1286 |
"rebalancing_recommendations": [
|
| 1287 |
{{"ticker": "ํฐ์ปค", "name": "๊ธฐ์
๋ช
", "reason": "๋ด ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ์์ ํจ๊ณผ"}}
|
| 1288 |
],
|
| 1289 |
"portfolio_outlook": {{
|
| 1290 |
"optimistic_pct": "+28%",
|
| 1291 |
-
"optimistic_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๋๊ด ์๋๋ฆฌ์ค
|
| 1292 |
"base_pct": "+10%",
|
| 1293 |
-
"base_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๊ธฐ๋ณธ ์๋๋ฆฌ์ค
|
| 1294 |
"pessimistic_pct": "-18%",
|
| 1295 |
-
"pessimistic_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๋น๊ด ์๋๋ฆฌ์ค
|
| 1296 |
"beta_note": "์ด ์ข
๋ชฉ ๋ฒ ํ ๊ธฐ๋ฐ ๋ณ๋ํญ ํด์ 1๋ฌธ์ฅ",
|
| 1297 |
"upside_note": "์ด ์ข
๋ชฉ ์ ๋๋ฆฌ์คํธ ์ปจ์ผ์์ค ์
์ฌ์ด๋ ํด์ 1๋ฌธ์ฅ",
|
| 1298 |
"valuation_note": "์ด ์ข
๋ชฉ ํ์ฌ ๋ฐธ๋ฅ์์ด์
(PERยท์ฑ์ฅ๋ฅ ) ์์ค ํ๊ฐ 1๋ฌธ์ฅ",
|
|
@@ -1303,9 +1303,9 @@ def get_scan_prompt(target, tid="", owned=None, news=None, portfolio_context="")
|
|
| 1303 |
def get_owned_prompt(target, tid="", news=None, portfolio_context=""):
|
| 1304 |
date_s = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 1305 |
news_s = ""
|
| 1306 |
-
if news: news_s = "\n[์ต๊ทผ ๋ด์ค
|
| 1307 |
port_s = f"\n{portfolio_context}" if portfolio_context else ""
|
| 1308 |
-
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ณด์ ์ง๋จ ์ ๋ฌธ๊ฐ
|
| 1309 |
{INVESTOR_PROFILE}
|
| 1310 |
[๋ถ์ ๋ชฉ์ ]
|
| 1311 |
์ด๋ฏธ ๋ณด์ ์ค์ธ ์ข
๋ชฉ์ ๋ํด '์ด ํฌ์์์ ์ ์ฒด ํฌํธํด๋ฆฌ์ค ์ํฉ'์ ๋จผ์ ํ์
ํ ๋ค,
|
|
@@ -1323,10 +1323,10 @@ def get_owned_prompt(target, tid="", news=None, portfolio_context=""):
|
|
| 1323 |
[์ถ๋ ฅ JSON ํ์]
|
| 1324 |
{{
|
| 1325 |
"recommendation_stars": "โ
โ
โ
โ
โ",
|
| 1326 |
-
"summary": "ํ ์ค ์์ฝ
|
| 1327 |
"action_type": "๋ณด์ /์ถ๊ฐ๋งค์/์ต์ /์์ ์ค ํ๋",
|
| 1328 |
"confidence_score": 0,
|
| 1329 |
-
"confidence_reason": "์ ๋ขฐ๋ ๊ทผ๊ฑฐ
|
| 1330 |
"portfolio_context_judgment": "ํฌํธํด๋ฆฌ์ค ์ ์ฒด ์์ต ๋ฐ ๊ตฌ์ฑ ๊ฐ์ ์ ์ด ์ข
๋ชฉ์ ํ์ฌ ์ญํ ๊ณผ ํ๋จ (3~4๋ฌธ์ฅ)",
|
| 1331 |
"thesis_validity": {{
|
| 1332 |
"verdict": "์ ํจ/ํผ์/์ ๊ฒํ์ ์ค ํ๏ฟฝ๏ฟฝ๏ฟฝ",
|
|
@@ -1335,19 +1335,20 @@ def get_owned_prompt(target, tid="", news=None, portfolio_context=""):
|
|
| 1335 |
"qualitative_check": "์ ์ฑ ์ ๊ฒ: ๊ฒฝ์๊ตฌ๋ยท๊ฒฝ์์งยทํด์ ๋ณํ (2~3๋ฌธ์ฅ)",
|
| 1336 |
"current_status": "์ข
ํฉ ํ์ ์์ฝ (2๋ฌธ์ฅ)"
|
| 1337 |
}},
|
| 1338 |
-
"action_analysis": "ํ์ฌ ์ก์
ํ๋จ (3๋ฌธ์ฅ)
|
| 1339 |
"additional_buy_analysis": {{
|
| 1340 |
"possible": true,
|
| 1341 |
-
"condition": "์ถ๊ฐ๋งค์ ๊ฐ๋ฅ ์กฐ๊ฑด
|
| 1342 |
-
"forbidden_condition": "์ถ๊ฐ๋งค์ ๊ธ์ง ์กฐ๊ฑด
|
| 1343 |
"suggested_price": "์ถ๊ฐ๋งค์ ์ ์ ๊ฐ๊ฒฉ๋ (์ํ)"
|
| 1344 |
}},
|
| 1345 |
"target_remaining": {{
|
| 1346 |
"target_price": "๋ชฉํ๊ฐ (์ํ)",
|
| 1347 |
"upside_pct": "ํ์ฌ๊ฐ ๋๋น ์์น ์ฌ๋ ฅ (%)",
|
| 1348 |
-
"exit_strategy": "๋ชฉํ๊ฐ ๋๋ฌ ์ ๋งค๋ ์ ๋ต
|
| 1349 |
-
"target_gap_reason": "AI ๋ชฉํ๊ฐ์ ์ ๋๋ฆฌ์คํธ ์ปจ์ผ์์ค ๋ชฉํ๊ฐ๊ฐ ์ฐจ์ด๋๋ ์ด์ - ์ด ์ข
๋ชฉ์ ์ฑ์ฅ ๊ธฐ๋์น
|
| 1350 |
}}
|
|
|
|
| 1351 |
|
| 1352 |
def get_portfolio_quant_metrics(df, prices, rate):
|
| 1353 |
"""
|
|
@@ -1505,7 +1506,7 @@ def get_portfolio_prompt(target, owned=None, sector_summary=None, beta_info=None
|
|
| 1505 |
if per_s:
|
| 1506 |
lines.append("- ์ข
๋ชฉ๋ณ ์ค๋ฐ์ดํฐ:")
|
| 1507 |
lines.extend(per_s)
|
| 1508 |
-
quant_s = "\n[ํฌํธํด๋ฆฌ์ค ์ค๋ฐ์ดํฐ ์ ๋ ์งํ
|
| 1509 |
|
| 1510 |
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ์ ๋ฌธ๊ฐ - {date_s}]
|
| 1511 |
{INVESTOR_PROFILE}
|
|
@@ -1595,9 +1596,9 @@ def render_portfolio_report(rpt):
|
|
| 1595 |
if isinstance(health, dict) and health:
|
| 1596 |
score_items = [
|
| 1597 |
("์ง์ค๋", health.get("concentration", {}), "๐"),
|
| 1598 |
-
("๋ณ๋์ฑ", health.get("volatility", {}), "
|
| 1599 |
("ํด์์ ํจ", health.get("thesis", {}), "๐ฏ"),
|
| 1600 |
-
("์์ต๋ชจ๋ฉ", health.get("return", {}), "
|
| 1601 |
]
|
| 1602 |
cards_html = ""
|
| 1603 |
for label, item, icon in score_items:
|
|
@@ -1625,7 +1626,7 @@ def render_portfolio_report(rpt):
|
|
| 1625 |
|
| 1626 |
# โโ ํญ 4๊ฐ
|
| 1627 |
tab_risk, tab_thesis, tab_rebal, tab_outlook = st.tabs([
|
| 1628 |
-
"๐ก ๋ฆฌ์คํฌ", "๐ฏ ํด์ ํํฉ", "๐ ๋ฆฌ๋ฐธ๋ฐ์ฑ", "
|
| 1629 |
])
|
| 1630 |
|
| 1631 |
# โโโโโโโโโโโ ํญ 1: ๋ฆฌ์คํฌ (๋์ ํ๋ฝ ์ํ + ๋ฆฌ์คํฌ ๊ธฐ์ฌ๋ + ์ง์ค๋) โโโโโโโโโโโ
|
|
@@ -1732,7 +1733,7 @@ def render_portfolio_report(rpt):
|
|
| 1732 |
ts_list = rpt.get("thesis_summary", [])
|
| 1733 |
if ts_list and isinstance(ts_list, list):
|
| 1734 |
verdict_cfg = {
|
| 1735 |
-
"์ ํจ": ("#AAAAAA", "
|
| 1736 |
"์ ๊ฒํ์": ("#D8D8D8", "๐"),
|
| 1737 |
"ํผ์": ("#E05C5C", "โ"),
|
| 1738 |
}
|
|
@@ -1849,7 +1850,7 @@ def render_portfolio_report(rpt):
|
|
| 1849 |
port_down = round(-10 * beta_val, 1)
|
| 1850 |
evidence_cards += (
|
| 1851 |
f'<div style="background:#111111; border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:14px 16px;">'
|
| 1852 |
-
f'<div style="font-size:9px; color:#444444; font-weight:700; text-transform:uppercase; letter-spacing:1px; margin-bottom:8px;">
|
| 1853 |
f'<div style="font-size:26px; font-weight:900; color:{beta_c}; font-family:DM Mono,monospace; margin-bottom:6px;">{beta_val}</div>'
|
| 1854 |
f'<div style="font-size:11px; color:#555555; line-height:1.6;">์์ฅ ยฑ10% ์ ํฌํธํด๋ฆฌ์ค<br>'
|
| 1855 |
f'<span style="color:#AAAAAA;">์์น +{port_up}%</span> / <span style="color:#E05C5C;">ํ๋ฝ {port_down}%</span> ์์</div>'
|
|
@@ -1944,7 +1945,7 @@ def render_portfolio_report(rpt):
|
|
| 1944 |
base = outlook.get("base", "-")
|
| 1945 |
pess = outlook.get("pessimistic", "-")
|
| 1946 |
notes = [
|
| 1947 |
-
("
|
| 1948 |
("๐ฏ ์ปจ์ผ์์ค", outlook.get("upside_note", "")),
|
| 1949 |
("๐ ๋ฐธ๋ฅ์์ด์
", outlook.get("valuation_note", "")),
|
| 1950 |
("โ ๏ธ ํต์ฌ ๋ฆฌ์คํฌ", outlook.get("key_risk", "")),
|
|
@@ -2017,7 +2018,7 @@ def render_target_price_compare(ai_target_str, analyst_target_krw, current_price
|
|
| 2017 |
gap_text_color = "#D8D8D8"
|
| 2018 |
gap_label = f"๋ ๋ชฉํ๊ฐ๊ฐ <b>{diff_pct:.0f}%</b> ์ฐจ์ด๋ฉ๋๋ค"
|
| 2019 |
else:
|
| 2020 |
-
gap_icon = "
|
| 2021 |
gap_color = "rgba(255,255,255,0.03)"
|
| 2022 |
gap_border= "rgba(255,255,255,0.10)"
|
| 2023 |
gap_text_color = "#888888"
|
|
@@ -2100,7 +2101,7 @@ def render_dividend_info(ticker):
|
|
| 2100 |
)
|
| 2101 |
|
| 2102 |
# ============================================================
|
| 2103 |
-
# โ
๊ฐ์ ๋ render_stock_header
|
| 2104 |
# ============================================================
|
| 2105 |
def render_stock_header(name, ticker, price, stars, mode_label, has_rich, extra_badges=None):
|
| 2106 |
"""
|
|
@@ -2162,7 +2163,7 @@ def render_stock_header(name, ticker, price, stars, mode_label, has_rich, extra_
|
|
| 2162 |
st.rerun()
|
| 2163 |
|
| 2164 |
# ============================================================
|
| 2165 |
-
# โ
๊ฐ์ ๋ render_owned_report
|
| 2166 |
# ============================================================
|
| 2167 |
def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
| 2168 |
if not rpt or not isinstance(rpt, dict): return
|
|
@@ -2186,7 +2187,7 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 2186 |
render_confidence_bar(conf_score, conf_reason)
|
| 2187 |
|
| 2188 |
# โโ ํญ ๋ถ๋ฆฌ: ์์ฝ / ํด์ / ์ก์
/ ๋ชฉํ๊ฐ
|
| 2189 |
-
tab_sum, tab_thesis, tab_action, tab_target = st.tabs(["๐ ์์ฝ", "๐ ํด์", "
|
| 2190 |
|
| 2191 |
# โโโโโโโโโโโ ํญ 1: ์์ฝ โโโโโโโโโโโ
|
| 2192 |
with tab_sum:
|
|
@@ -2295,7 +2296,7 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 2295 |
f'</div>'
|
| 2296 |
f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:12px;">'
|
| 2297 |
f'<div style="background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.10); border-radius:8px; padding:12px;">'
|
| 2298 |
-
f'<div style="font-size:9px; color:#AAAAAA; font-weight:700; margin-bottom:6px; text-transform:uppercase; letter-spacing:1px;">
|
| 2299 |
f'<div style="font-size:12px; color:#888888; line-height:1.7;">{condition}</div></div>'
|
| 2300 |
f'<div style="background:rgba(200,60,60,0.08); border:1px solid rgba(212,90,90,0.18); border-radius:8px; padding:12px;">'
|
| 2301 |
f'<div style="font-size:9px; color:#E0E0E0; font-weight:700; margin-bottom:6px; text-transform:uppercase; letter-spacing:1px;">๐ซ ๊ธ์ง ์กฐ๊ฑด</div>'
|
|
@@ -2359,7 +2360,7 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 2359 |
render_confidence_bar(conf_score, conf_reason)
|
| 2360 |
|
| 2361 |
# โโ ์ค์บ ๋ฆฌํฌํธ๋ ํญ์ผ๋ก ๋ถ๋ฆฌ
|
| 2362 |
-
tab_fit, tab_growth, tab_timing, tab_risk, tab_outlook = st.tabs(["๐ ํฌํธํด๋ฆฌ์ค ์ ํฉ", "๐ก ์ฑ์ฅ ํด์", "โฑ ํ์ด๋ฐ", "! ๋ฆฌ์คํฌ", "
|
| 2363 |
|
| 2364 |
with tab_fit:
|
| 2365 |
pfit = rpt.get("portfolio_fit", {})
|
|
@@ -2368,7 +2369,7 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 2368 |
st.markdown(
|
| 2369 |
f'<div style="background:rgba(255,255,255,0.04); border:1px solid rgba(201,168,76,0.2); '
|
| 2370 |
f'border-radius:10px; padding:16px; margin-top:12px; margin-bottom:12px;">'
|
| 2371 |
-
f'<div style="font-size:10px; font-weight:700; color:#D8D8D8; letter-spacing:1.5px; text-transform:uppercase; margin-bottom:8px;">
|
| 2372 |
f'<div style="font-size:14px; color:#888888; line-height:1.8;">{safe_cat}</div></div>',
|
| 2373 |
unsafe_allow_html=True
|
| 2374 |
)
|
|
@@ -2835,10 +2836,10 @@ def render_grouped_alert_panel(prices, rate):
|
|
| 2835 |
}}
|
| 2836 |
var s = window.parent._alState;
|
| 2837 |
var CAT = {{
|
| 2838 |
-
'๊ธ๋ณ': {{icon:'
|
| 2839 |
-
'๋งค์': {{icon:'
|
| 2840 |
-
'์ต์ ': {{icon:'
|
| 2841 |
-
'์คํฑ๋ก์ค':{{icon:'
|
| 2842 |
}};
|
| 2843 |
function totalCount() {{
|
| 2844 |
var n = 0, keys = ['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค'];
|
|
@@ -2864,7 +2865,7 @@ def render_grouped_alert_panel(prices, rate):
|
|
| 2864 |
function renderPanel() {{
|
| 2865 |
var cnt = totalCount();
|
| 2866 |
if (s.minimized) {{
|
| 2867 |
-
root.innerHTML = '<div id="al-badge" style="display:flex;align-items:center;gap:10px;background:linear-gradient(135deg,#161616,#111111);border:1px solid rgba(255,255,255,0.17);border-radius:40px;padding:10px 20px;cursor:pointer;box-shadow:0 8px 32px rgba(0,0,0,0.5);animation:alBadgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);user-select:none;"><div style="position:relative;"><span style="font-size:20px;">
|
| 2868 |
pdoc.getElementById('al-badge').onclick = function() {{ s.minimized=false; s.timeLeft=60; renderPanel(); startTimer(); }};
|
| 2869 |
return;
|
| 2870 |
}}
|
|
@@ -2879,10 +2880,10 @@ def render_grouped_alert_panel(prices, rate):
|
|
| 2879 |
}} else {{
|
| 2880 |
for (var ii=0; ii<items.length; ii++) {{
|
| 2881 |
var item = items[ii];
|
| 2882 |
-
itemHtml += '<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.025);border:1px solid transparent;transition:all 0.18s;animation:alItemIn 0.3s ease '+(ii*0.06)+'s both;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#EBEBEB;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.17);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(201,168,76,0.5);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.14);margin-top:2px;">
|
| 2883 |
}}
|
| 2884 |
}}
|
| 2885 |
-
root.innerHTML = '<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);"><div style="background:linear-gradient(135deg,#1C1C1C,#131313);border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#D8D8D8;box-shadow:0 0 8px rgba(255,255,255,0.40);animation:alPulse 1.5s infinite;"></div><span style="color:#EBEBEB;font-size:13px;font-weight:700;letter-spacing:0.08em;">LIVE ALERTS</span><span style="background:rgba(200,60,60,0.12);border:1px solid rgba(212,90,90,0.25);border-radius:6px;padding:1px 7px;font-size:11px;color:#E0E0E0;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(255,255,255,0.04);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;color:'+(tl>20?'rgba(201,168,76,0.5)':'#E0E0E0')+';font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.16);font-size:18px;padding:4px 8px;border-radius:6px;transition:all 0.2s;line-height:1;">
|
| 2886 |
pdoc.getElementById('al-minbtn').onclick = function(e) {{ e.stopPropagation(); s.minimized=true; clearInterval(s.timer); renderPanel(); }};
|
| 2887 |
root.querySelectorAll('.al-tab').forEach(function(btn) {{ btn.onclick = function() {{ s.tab = btn.getAttribute('data-tab'); renderPanel(); }}; }});
|
| 2888 |
root.querySelectorAll('.al-item').forEach(function(el) {{ el.onclick = function() {{ gotoTicker(el.getAttribute('data-ticker')); }}; }});
|
|
@@ -3104,7 +3105,7 @@ def render_earnings_calendar(tickers, label="๋ณด์ ์ข
๋ชฉ"):
|
|
| 3104 |
)
|
| 3105 |
if imminent > 0:
|
| 3106 |
summary_html += (
|
| 3107 |
-
f'<span style="background:rgba(200,60,60,0.12);border:1px solid rgba(200,60,60,0.24);border-radius:5px;padding:3px 10px;font-size:11px;font-weight:700;color:#E0E0E0;animation:alertPulse 1.8s ease-in-out infinite;">
|
| 3108 |
)
|
| 3109 |
summary_html += '</div>'
|
| 3110 |
|
|
@@ -3112,7 +3113,7 @@ def render_earnings_calendar(tickers, label="๋ณด์ ์ข
๋ชฉ"):
|
|
| 3112 |
<div style="background:linear-gradient(135deg,#1C1C1C 0%,#111111 100%);border:1px solid rgba(255,255,255,0.09);border-radius:16px;padding:20px;margin-bottom:16px;box-shadow:inset 0 1px 0 rgba(255,255,255,0.05),0 4px 24px rgba(0,0,0,0.4);">
|
| 3113 |
<div style="display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:18px;">
|
| 3114 |
<div>
|
| 3115 |
-
<div style="font-size:10px;font-weight:700;color:#444444;letter-spacing:2px;text-transform:uppercase;margin-bottom:5px;">
|
| 3116 |
<div style="font-size:22px;font-weight:900;color:#EBEBEB;letter-spacing:-0.5px;">{month_name}</div>
|
| 3117 |
</div>
|
| 3118 |
<div style="display:flex;flex-direction:column;gap:5px;align-items:flex-end;padding-top:4px;">{summary_html}</div>
|
|
@@ -3222,7 +3223,7 @@ elif st.session_state.main_menu == "โ ํ & ์ค์บ":
|
|
| 3222 |
st.markdown("""
|
| 3223 |
<div style="background:linear-gradient(135deg,#1C1C1C 0%,#111111 100%); border:1px solid rgba(255,255,255,0.09); border-radius:14px; padding:28px; margin-bottom:20px;">
|
| 3224 |
<h3 style="color:#EBEBEB; margin-bottom:18px; font-size:18px;">Invest Pro Alpha์ ์ค์ ๊ฑธ ํ์ํฉ๋๋ค</h3>
|
| 3225 |
-
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 1.</b> ์์ฐ ์์ธ ์ง๋จ
|
| 3226 |
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 2.</b> AI ์ค์บ์ผ๋ก ์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ถ์</div>
|
| 3227 |
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 3.</b> ๋งค๋งค ์ผ์ง๋ก ์น๋ฅ ยท์์ต๋น ๋ฐ์ดํฐ ์๊ธฐ</div>
|
| 3228 |
</div>
|
|
@@ -3364,7 +3365,7 @@ elif st.session_state.main_menu == "โ ํ & ์ค์บ":
|
|
| 3364 |
if _prices:
|
| 3365 |
_zone_top = max(_prices)
|
| 3366 |
if p <= _zone_top:
|
| 3367 |
-
render_price_alert('tp_hit', f"ํ์ฌ๊ฐ {p:,}์
|
| 3368 |
elif p <= _zone_top * 1.05:
|
| 3369 |
render_price_alert('tp', f"1์ฐจ ๋ถํ ๋งค์ ๊ตฌ๊ฐ({_zone_top:,}์) ๊ทผ์ ์ค", tn, n)
|
| 3370 |
|
|
@@ -3745,7 +3746,7 @@ elif st.session_state.main_menu == "โค ์์ฐ ์์ธ ์ง๋จ":
|
|
| 3745 |
pc = "#E0E0E0" if pct>=0 else "#9ABBE0"
|
| 3746 |
pa = "โฒ" if pct>=0 else "โผ"
|
| 3747 |
buy_reason = str(row.get('๋งค์๊ทผ๊ฑฐ', '') or '').strip()
|
| 3748 |
-
tgp_val = tgp if tgp != "-" else "
|
| 3749 |
|
| 3750 |
with st.container(border=True):
|
| 3751 |
st.markdown('<div class="portfolio-item-row-marker"></div>', unsafe_allow_html=True)
|
|
@@ -3996,17 +3997,17 @@ components.html("""<!DOCTYPE html>
|
|
| 3996 |
var root = pdoc.getElementById(PID);
|
| 3997 |
if(!root) return;
|
| 3998 |
var CAT = {
|
| 3999 |
-
'๊ธ๋ณ': {icon:'
|
| 4000 |
-
'๋งค์': {icon:'
|
| 4001 |
-
'์ต์ ': {icon:'
|
| 4002 |
-
'์คํฑ๋ก์ค':{icon:'
|
| 4003 |
};
|
| 4004 |
function totalCount(){ var n=0,keys=['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค']; for(var i=0;i<keys.length;i++) n+=(s.data[keys[i]]||[]).length; return n; }
|
| 4005 |
function gotoTicker(ticker){ window.parent.history.replaceState(null,'','?alert_action=goto:'+ticker); pdoc.querySelectorAll('button').forEach(function(b){ if(b.textContent&&b.textContent.trim()==='alert_trigger') b.click(); }); }
|
| 4006 |
function startTimer(){ if(s.timer) clearInterval(s.timer); if(s.minimized) return; s.timer=setInterval(function(){ s.timeLeft=Math.max(0,s.timeLeft-1); var el=pdoc.getElementById('al-timer-span'); if(el){ el.textContent=s.timeLeft+'s'; el.style.color=s.timeLeft>20?'rgba(201,168,76,0.5)':'#E0E0E0'; } if(s.timeLeft<=0){ clearInterval(s.timer); s.minimized=true; renderPanel(); } },1000); }
|
| 4007 |
function renderPanel(){
|
| 4008 |
var cnt=totalCount();
|
| 4009 |
-
if(s.minimized){ root.innerHTML='<div id="al-badge" style="display:flex;align-items:center;gap:10px;background:linear-gradient(135deg,#161616,#111111);border:1px solid rgba(255,255,255,0.17);border-radius:40px;padding:10px 20px;cursor:pointer;box-shadow:0 8px 32px rgba(0,0,0,0.5);user-select:none;"><div style="position:relative;"><span style="font-size:20px;">
|
| 4010 |
var tab=s.tab,cfg=CAT[tab]||CAT['๊ธ๋ณ'],items=s.data[tab]||[],tl=s.timeLeft;
|
| 4011 |
var tabKeys=['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค'],tabHtml='',itemHtml='';
|
| 4012 |
for(var ti=0;ti<tabKeys.length;ti++){
|
|
@@ -4018,10 +4019,10 @@ for(var ti=0;ti<tabKeys.length;ti++){
|
|
| 4018 |
} else {
|
| 4019 |
for(var ii=0;ii<items.length;ii++){
|
| 4020 |
var item=items[ii];
|
| 4021 |
-
itemHtml+='<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.025);border:1px solid transparent;transition:all 0.18s;animation:alItemIn 0.3s ease '+(ii*0.06)+'s both;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#EBEBEB;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.17);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(201,168,76,0.5);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.14);margin-top:2px;">
|
| 4022 |
}
|
| 4023 |
}
|
| 4024 |
-
root.innerHTML='<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);"><div style="background:linear-gradient(135deg,#1C1C1C,#131313);border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#D8D8D8;box-shadow:0 0 8px rgba(255,255,255,0.40);animation:alPulse 1.5s infinite;"></div><span style="color:#EBEBEB;font-size:13px;font-weight:700;letter-spacing:0.08em;">LIVE ALERTS</span><span style="background:rgba(200,60,60,0.12);border:1px solid rgba(212,90,90,0.25);border-radius:6px;padding:1px 7px;font-size:11px;color:#E0E0E0;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(255,255,255,0.04);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.16);font-size:18px;padding:4px 8px;border-radius:6px;transition:all 0.2s;line-height:1;">
|
| 4025 |
pdoc.getElementById('al-minbtn').onclick=function(e){e.stopPropagation();s.minimized=true;clearInterval(s.timer);renderPanel();};
|
| 4026 |
root.querySelectorAll('.al-tab').forEach(function(btn){btn.onclick=function(){s.tab=btn.getAttribute('data-tab');renderPanel();};});
|
| 4027 |
root.querySelectorAll('.al-item').forEach(function(el){el.onclick=function(){gotoTicker(el.getAttribute('data-ticker'));};});
|
|
|
|
| 511 |
}
|
| 512 |
.pca-icon:hover { color: #AAAAAA; background: rgba(255,255,255,0.09); }
|
| 513 |
.pca-icon-del:hover { color: #CC5555 !important; background: rgba(180,60,60,0.12) !important; }
|
| 514 |
+
/* PCATRIGGER ์จ๊ธด ๋ฒํผ - JS๋ก ์ฒ๋ฆฌ */
|
| 515 |
/* โโ ํฌํธํด๋ฆฌ์ค ์นด๋ ๋ฒํผํ: ์นด๋ HTML ๋ฐ๋ก ์๋ ๋ถ์ด๊ธฐ */
|
| 516 |
.port-card-btn-row {
|
| 517 |
background: linear-gradient(135deg, #161616 0%, #0E0E0E 100%);
|
|
|
|
| 684 |
st.session_state.pop(k, None)
|
| 685 |
|
| 686 |
st.button("โฌข INVEST PRO ALPHA", key="header_logo_btn", help="header_logo", on_click=go_home)
|
| 687 |
+
# pca_trigger ์จ๊ธด ๋ฒํผ - JS๊ฐ innerText="PCATRIGGER"๋ก ์ฐพ์์ ํด๋ฆญ
|
| 688 |
st.button("PCATRIGGER", key="pca_trigger_btn")
|
| 689 |
|
| 690 |
+
# โโ pca_action query param ์ฒ๋ฆฌ (์นด๋ ์์ด์ฝ ๋ฒํผ -> JS -> query param -> ์ฌ๊ธฐ์ ์ฒ๋ฆฌ)
|
| 691 |
_pca = st.query_params.get("pca_action", "")
|
| 692 |
if _pca:
|
| 693 |
from urllib.parse import unquote
|
|
|
|
| 838 |
"summary": f"๋ชจ๋ ๋ชจ๋ธ ์๋ต ์คํจ. ์ ์ ํ ์ฌ์๋ํด ์ฃผ์ธ์. ({err_summary})",
|
| 839 |
"recommendation_stars": "๋ถ์๋ถ๊ฐ",
|
| 840 |
"confidence_score": 0,
|
| 841 |
+
"confidence_reason": f"API ์ค๋ฅ๋ก ๋ถ์ ๋ถ๊ฐ - {err_summary}",
|
| 842 |
}
|
| 843 |
)
|
| 844 |
|
|
|
|
| 1076 |
rp = st.session_state.full_stock_reports.get(f"{t}_{ap}", {}).get("report", {})
|
| 1077 |
act = rp.get("action_type", "๋ฏธ๋ถ์")
|
| 1078 |
lines.append(
|
| 1079 |
+
f" ยท {row['์ข
๋ชฉ๋ช
']}({t}): ํ๋จ {int(ap):,}์ -> ํ์ฌ {int(ck):,}์ "
|
| 1080 |
f"({pct:+.1f}%), ์๋ {qty}์ฃผ, ์ ๋ตํ์ [{act}]"
|
| 1081 |
)
|
| 1082 |
port_pct = (total_val / total_cost - 1) * 100 if total_cost > 0 else 0
|
| 1083 |
header = (
|
| 1084 |
+
f"[๋ด ํฌํธํด๋ฆฌ์ค ํํฉ - ๋ถ์ ๊ธฐ์ค์ผ: {datetime.now().strftime('%Y-%m-%d')}]\n"
|
| 1085 |
f" ์ด ํฌ์์๊ธ: {int(total_cost):,}์ / ์ด ํ๊ฐ์ก: {int(total_val):,}์ / "
|
| 1086 |
f"์ ์ฒด ์์ต๋ฅ : {port_pct:+.1f}%\n"
|
| 1087 |
f" ๋ณด์ ์ข
๋ชฉ ({len(lines)}๊ฐ):\n"
|
|
|
|
| 1199 |
def save_assets():
|
| 1200 |
st.session_state.df.to_csv(DB_FILE, index=False); _hf_ul(DB_FILE)
|
| 1201 |
|
| 1202 |
+
# pca_del ํ๋๊ทธ ์ฒ๋ฆฌ (query param -> save_assets ์ ์ ํ์ ์คํ)
|
| 1203 |
if "_pca_del_idx" in st.session_state and "df" in st.session_state:
|
| 1204 |
_di = st.session_state.pop("_pca_del_idx")
|
| 1205 |
if _di in st.session_state.df.index:
|
|
|
|
| 1228 |
# AI ํ๋กฌํํธ
|
| 1229 |
# ============================================================
|
| 1230 |
INVESTOR_PROFILE = """
|
| 1231 |
+
[ํฌ์์ ํ๋กํ - ๋ฐ๋์ ์ด ๊ธฐ์ค์ผ๋ก ๋ถ์]
|
| 1232 |
- ํฌ์ ์ฑํฅ: ์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ํฌ์์ (6๊ฐ์ ์ด์ ๋ณด์ ์์น)
|
| 1233 |
- ์ ํธ ์ข
๋ชฉ: ์ฑ์ฅํ ์ฃผ์, ํด์ด๋ผ์ด๋ ์ฃผ์, ๊ธฐ์ ์ฃผ
|
| 1234 |
- ๋ฆฌ์คํฌ ํ์ฉ๋: ์ค๊ฐ~๋์ (์ฑ์ฅ๊ณผ ํด์ด๋ผ์ด๋๋ฅผ ์ํ ๋ฆฌ์คํฌ๋ ์์ฉ)
|
|
|
|
| 1240 |
owned_s = ", ".join(owned) if owned else "์์"
|
| 1241 |
date_s = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 1242 |
news_s = ""
|
| 1243 |
+
if news: news_s = "\n[์ต๊ทผ ๋ด์ค - ๋ถ์์ ๋ฐ๋์ ๋ฐ์]\n" + "\n".join(news)
|
| 1244 |
port_s = f"\n{portfolio_context}" if portfolio_context else ""
|
| 1245 |
+
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ถ์ ์ ๋ฌธ๊ฐ - {date_s} / ID:{tid}_{random.randint(100,999)}]
|
| 1246 |
{INVESTOR_PROFILE}
|
| 1247 |
[๋ถ์ ๋ชฉ์ ]
|
| 1248 |
์ด ํฌ์์์ ํ์ฌ ํฌํธํด๋ฆฌ์ค ์ํฉ๊ณผ ๊ธฐ๋ณด์ ์ข
๋ชฉ์ ๋จผ์ ํ์
ํ ๋ค,
|
|
|
|
| 1255 |
4. ๊ฐ ํญ๋ชฉ๋ง๋ค ๊ทผ๊ฑฐ ๋ฐ์ดํฐ 1๊ฐ ์ด์ ๋ช
์.
|
| 1256 |
5. ์์ JSON๋ง ์ถ๋ ฅ. ๋งํฌ๋ค์ด ๊ธฐํธ ๊ธ์ง.
|
| 1257 |
6. ์ ๋(์ซ์) ๊ทผ๊ฑฐ์ ์ ์ฑ(ํ๋จ) ๊ทผ๊ฑฐ๋ฅผ ๋ฐ๋์ ๋ถ๋ฆฌํด์ ์ ์.
|
| 1258 |
+
7. ํฌํธํด๋ฆฌ์ค ๋งฅ๋ฝ์ ๋ฐ๋์ ๋ฐ์ - ๊ธฐ๋ณด์ ์ข
๋ชฉ๊ณผ์ ์นํฐ ์ค๋ณต, ๋ฆฌ์ค๏ฟฝ๏ฟฝ๏ฟฝ ๋ถ์ฐ ํจ๊ณผ ๋ฑ ํฌํธํด๋ฆฌ์ค์ ์ฃผ๋ ์ํฅ ์ธ๊ธ.
|
| 1259 |
{news_s}
|
| 1260 |
[๋ถ์ ๋์ ์ข
๋ชฉ ๋ฐ์ดํฐ]
|
| 1261 |
{target}
|
| 1262 |
+
[์ด๋ฏธ ๋ณด์ ์ค์ธ ์ข
๋ชฉ - ์ค๋ณต ์ถ์ฒ ๊ธ์ง] {owned_s}
|
| 1263 |
[์ถ๋ ฅ JSON ํ์]
|
| 1264 |
{{
|
| 1265 |
"recommendation_stars": "โ
โ
โ
โ
โ",
|
| 1266 |
+
"summary": "ํ ์ค ์์ฝ - ๋ฐ๋์ '๋ด ํฌํธํด๋ฆฌ์ค์' ํธ์
์ฌ๋ถ๋ก ๊ฒฐ๋ก ",
|
| 1267 |
"action_type": "๋งค์/๊ด๋ง/์ ์ธ ์ค ํ๋",
|
| 1268 |
"confidence_score": 0,
|
| 1269 |
+
"confidence_reason": "์ ๋ขฐ๋ ๊ทผ๊ฑฐ - ํฌํธํด๋ฆฌ์ค ๋งฅ๋ฝ ํฌํจ",
|
| 1270 |
"portfolio_fit": {{
|
| 1271 |
"sector_overlap": "๊ธฐ๋ณด์ ์ข
๋ชฉ๊ณผ์ ์นํฐ/ํ
๋ง ์ค๋ณต ์ฌ๋ถ",
|
| 1272 |
"risk_diversification": "ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ๋ถ์ฐ์ ๊ธฐ์ฌํ๋๊ฐ",
|
|
|
|
| 1274 |
}},
|
| 1275 |
"growth_moat_quantitative": "์ ๋ ๊ทผ๊ฑฐ (2~3๋ฌธ์ฅ)",
|
| 1276 |
"growth_moat_qualitative": "์ ์ฑ ๊ทผ๊ฑฐ (2~3๋ฌธ์ฅ, ์ฑ์ฅ์ฃผ/ํด์ด๋ผ์ด๋ ๊ตฌ๋ถ ๋ช
์)",
|
| 1277 |
+
"timing_entry_analysis": "์ค์ฅ๊ธฐ ์ง์
ํ์ด๋ฐ ๋ถ์ (2~3๋ฌธ์ฅ) - ํ์ฌ ๋ด ํฌํธํด๋ฆฌ์ค ์ํฉ ๊ฐ์",
|
| 1278 |
"entry_zones": {{
|
| 1279 |
"first_buy": "1์ฐจ ๋ถํ ๋งค์ ์ ์ ๊ฐ๊ฒฉ๋ (์ํ)",
|
| 1280 |
"second_buy": "2์ฐจ ์ถ๊ฐ๋งค์ ๊ฐ๊ฒฉ๋ (์ํ)",
|
| 1281 |
"stop_thesis": "์ด ๊ฐ๊ฒฉ/์กฐ๊ฑด์ด๋ฉด ์ฑ์ฅ ์คํ ๋ฆฌ ๋ถ๊ดด"
|
| 1282 |
}},
|
| 1283 |
"valuation_growth_fit": "์ฑ์ฅ๋ฅ ๋๋น ๋ฐธ๋ฅ์์ด์
ํ๋จ (2~3๋ฌธ์ฅ)",
|
| 1284 |
+
"tech_risk_hedge": "๊ธฐ์ ์ฃผ ์ง์ค ๋ฆฌ์คํฌ ๋ฐ ํค์ง ์กฐ์ธ - ๋ด ๊ธฐ์กด ํฌํธํด๋ฆฌ์ค ๋๋น (2~3๋ฌธ์ฅ)",
|
| 1285 |
"catalyst": "์ง๊ธ ํฌ์ํด์ผ ํ ๊ตฌ์ฒด์ ์ด๋งค",
|
| 1286 |
"rebalancing_recommendations": [
|
| 1287 |
{{"ticker": "ํฐ์ปค", "name": "๊ธฐ์
๋ช
", "reason": "๋ด ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ์์ ํจ๊ณผ"}}
|
| 1288 |
],
|
| 1289 |
"portfolio_outlook": {{
|
| 1290 |
"optimistic_pct": "+28%",
|
| 1291 |
+
"optimistic_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๋๊ด ์๋๋ฆฌ์ค - ๊ตฌ์ฒด์ ์ด๋งคยท์ค์ ยท์ด๋ฒคํธ ๊ธฐ๋ฐ 2๋ฌธ์ฅ",
|
| 1292 |
"base_pct": "+10%",
|
| 1293 |
+
"base_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๊ธฐ๋ณธ ์๋๋ฆฌ์ค - ํ์ฌ ์ปจ์ผ์์ค ๊ธฐ๋ฐ 2๋ฌธ์ฅ",
|
| 1294 |
"pessimistic_pct": "-18%",
|
| 1295 |
+
"pessimistic_desc": "์ด ์ข
๋ชฉ ๊ณ ์ ์ ๋น๊ด ์๋๋ฆฌ์ค - ๊ตฌ์ฒด์ ๋ฆฌ์คํฌ ์คํ ์กฐ๊ฑด 2๋ฌธ์ฅ",
|
| 1296 |
"beta_note": "์ด ์ข
๋ชฉ ๋ฒ ํ ๊ธฐ๋ฐ ๋ณ๋ํญ ํด์ 1๋ฌธ์ฅ",
|
| 1297 |
"upside_note": "์ด ์ข
๋ชฉ ์ ๋๋ฆฌ์คํธ ์ปจ์ผ์์ค ์
์ฌ์ด๋ ํด์ 1๋ฌธ์ฅ",
|
| 1298 |
"valuation_note": "์ด ์ข
๋ชฉ ํ์ฌ ๋ฐธ๋ฅ์์ด์
(PERยท์ฑ์ฅ๋ฅ ) ์์ค ํ๊ฐ 1๋ฌธ์ฅ",
|
|
|
|
| 1303 |
def get_owned_prompt(target, tid="", news=None, portfolio_context=""):
|
| 1304 |
date_s = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 1305 |
news_s = ""
|
| 1306 |
+
if news: news_s = "\n[์ต๊ทผ ๋ด์ค - ํด์ ์ ํจ์ฑ ํ๋จ์ ๋ฐ์]\n" + "\n".join(news)
|
| 1307 |
port_s = f"\n{portfolio_context}" if portfolio_context else ""
|
| 1308 |
+
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ณด์ ์ง๋จ ์ ๋ฌธ๊ฐ - {date_s} / ID:{tid}_{random.randint(100,999)}]
|
| 1309 |
{INVESTOR_PROFILE}
|
| 1310 |
[๋ถ์ ๋ชฉ์ ]
|
| 1311 |
์ด๋ฏธ ๋ณด์ ์ค์ธ ์ข
๋ชฉ์ ๋ํด '์ด ํฌ์์์ ์ ์ฒด ํฌํธํด๋ฆฌ์ค ์ํฉ'์ ๋จผ์ ํ์
ํ ๋ค,
|
|
|
|
| 1323 |
[์ถ๋ ฅ JSON ํ์]
|
| 1324 |
{{
|
| 1325 |
"recommendation_stars": "โ
โ
โ
โ
โ",
|
| 1326 |
+
"summary": "ํ ์ค ์์ฝ - ๋ฐ๋์ '๋ด ํฌํธํด๋ฆฌ์ค ์ ์ฒด ๋งฅ๋ฝ์์' ์ด ์ข
๋ชฉ์ ํ์ฌ ์์น",
|
| 1327 |
"action_type": "๋ณด์ /์ถ๊ฐ๋งค์/์ต์ /์์ ์ค ํ๋",
|
| 1328 |
"confidence_score": 0,
|
| 1329 |
+
"confidence_reason": "์ ๋ขฐ๋ ๊ทผ๊ฑฐ - ํฌํธํด๋ฆฌ์ค ๋งฅ๋ฝ ํฌํจ",
|
| 1330 |
"portfolio_context_judgment": "ํฌํธํด๋ฆฌ์ค ์ ์ฒด ์์ต ๋ฐ ๊ตฌ์ฑ ๊ฐ์ ์ ์ด ์ข
๋ชฉ์ ํ์ฌ ์ญํ ๊ณผ ํ๋จ (3~4๋ฌธ์ฅ)",
|
| 1331 |
"thesis_validity": {{
|
| 1332 |
"verdict": "์ ํจ/ํผ์/์ ๊ฒํ์ ์ค ํ๏ฟฝ๏ฟฝ๏ฟฝ",
|
|
|
|
| 1335 |
"qualitative_check": "์ ์ฑ ์ ๊ฒ: ๊ฒฝ์๊ตฌ๋ยท๊ฒฝ์์งยทํด์ ๋ณํ (2~3๋ฌธ์ฅ)",
|
| 1336 |
"current_status": "์ข
ํฉ ํ์ ์์ฝ (2๋ฌธ์ฅ)"
|
| 1337 |
}},
|
| 1338 |
+
"action_analysis": "ํ์ฌ ์ก์
ํ๋จ (3๋ฌธ์ฅ) - ํฌํธํด๋ฆฌ์ค ์ ์ฒด ์ํฉ์ ๋ฐ๋์ ๋ฐ์",
|
| 1339 |
"additional_buy_analysis": {{
|
| 1340 |
"possible": true,
|
| 1341 |
+
"condition": "์ถ๊ฐ๋งค์ ๊ฐ๋ฅ ์กฐ๊ฑด - ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ์์ค ํฌํจ",
|
| 1342 |
+
"forbidden_condition": "์ถ๊ฐ๋งค์ ๊ธ์ง ์กฐ๊ฑด - ํฌํธํด๋ฆฌ์ค ์ ์ฒด ์์ค/์ง์ค๋ ํฌํจ",
|
| 1343 |
"suggested_price": "์ถ๊ฐ๋งค์ ์ ์ ๊ฐ๊ฒฉ๋ (์ํ)"
|
| 1344 |
}},
|
| 1345 |
"target_remaining": {{
|
| 1346 |
"target_price": "๋ชฉํ๊ฐ (์ํ)",
|
| 1347 |
"upside_pct": "ํ์ฌ๊ฐ ๋๋น ์์น ์ฌ๋ ฅ (%)",
|
| 1348 |
+
"exit_strategy": "๋ชฉํ๊ฐ ๋๋ฌ ์ ๋งค๋ ์ ๋ต - ํฌํธํด๋ฆฌ์ค ๋ฆฌ๋ฐธ๋ฐ์ฑ ๊ด์ ํฌํจ",
|
| 1349 |
+
"target_gap_reason": "AI ๋ชฉํ๊ฐ์ ์ ๋๋ฆฌ์คํธ ์ปจ์ผ์์ค ๋ชฉํ๊ฐ๊ฐ ์ฐจ์ด๋๋ ์ด์ - ์ด ์ข
๋ชฉ์ ์ฑ์ฅ ๊ธฐ๋์น, ๋ฐธ๋ฅ์์ด์
๊ด์ , ๋ฆฌ์คํฌ ์ธ์ ์ฐจ์ด๋ฅผ ๊ตฌ์ฒด์ ์ผ๋ก 2~3๋ฌธ์ฅ. ๋น์ทํ๋ฉด ์ ์ผ์นํ๋์ง ์ค๋ช
"
|
| 1350 |
}}
|
| 1351 |
+
}}"""
|
| 1352 |
|
| 1353 |
def get_portfolio_quant_metrics(df, prices, rate):
|
| 1354 |
"""
|
|
|
|
| 1506 |
if per_s:
|
| 1507 |
lines.append("- ์ข
๋ชฉ๋ณ ์ค๋ฐ์ดํฐ:")
|
| 1508 |
lines.extend(per_s)
|
| 1509 |
+
quant_s = "\n[ํฌํธํด๋ฆฌ์ค ์ค๋ฐ์ดํฐ ์ ๋ ์งํ - ์ง์ ๊ณ์ฐ๊ฐ, ํ๊ฐ ๊ธ์ง]\n" + "\n".join(lines) + "\n"
|
| 1510 |
|
| 1511 |
return f"""[์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ํฌํธํด๋ฆฌ์ค ๋ฆฌ์คํฌ ์ ๋ฌธ๊ฐ - {date_s}]
|
| 1512 |
{INVESTOR_PROFILE}
|
|
|
|
| 1596 |
if isinstance(health, dict) and health:
|
| 1597 |
score_items = [
|
| 1598 |
("์ง์ค๋", health.get("concentration", {}), "๐"),
|
| 1599 |
+
("๋ณ๋์ฑ", health.get("volatility", {}), "⚡"),
|
| 1600 |
("ํด์์ ํจ", health.get("thesis", {}), "๐ฏ"),
|
| 1601 |
+
("์์ต๋ชจ๋ฉ", health.get("return", {}), "📈"),
|
| 1602 |
]
|
| 1603 |
cards_html = ""
|
| 1604 |
for label, item, icon in score_items:
|
|
|
|
| 1626 |
|
| 1627 |
# โโ ํญ 4๊ฐ
|
| 1628 |
tab_risk, tab_thesis, tab_rebal, tab_outlook = st.tabs([
|
| 1629 |
+
"๐ก ๋ฆฌ์คํฌ", "๐ฏ ํด์ ํํฉ", "๐ ๋ฆฌ๋ฐธ๋ฐ์ฑ", "📈 ์์ต๋ฅ ์ ๋ง"
|
| 1630 |
])
|
| 1631 |
|
| 1632 |
# โโโโโโโโโโโ ํญ 1: ๋ฆฌ์คํฌ (๋์ ํ๋ฝ ์ํ + ๋ฆฌ์คํฌ ๊ธฐ์ฌ๋ + ์ง์ค๋) โโโโโโโโโโโ
|
|
|
|
| 1733 |
ts_list = rpt.get("thesis_summary", [])
|
| 1734 |
if ts_list and isinstance(ts_list, list):
|
| 1735 |
verdict_cfg = {
|
| 1736 |
+
"์ ํจ": ("#AAAAAA", "✅"),
|
| 1737 |
"์ ๊ฒํ์": ("#D8D8D8", "๐"),
|
| 1738 |
"ํผ์": ("#E05C5C", "โ"),
|
| 1739 |
}
|
|
|
|
| 1850 |
port_down = round(-10 * beta_val, 1)
|
| 1851 |
evidence_cards += (
|
| 1852 |
f'<div style="background:#111111; border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:14px 16px;">'
|
| 1853 |
+
f'<div style="font-size:9px; color:#444444; font-weight:700; text-transform:uppercase; letter-spacing:1px; margin-bottom:8px;">⚡ ๊ฐ์คํ๊ท ๋ฒ ํ</div>'
|
| 1854 |
f'<div style="font-size:26px; font-weight:900; color:{beta_c}; font-family:DM Mono,monospace; margin-bottom:6px;">{beta_val}</div>'
|
| 1855 |
f'<div style="font-size:11px; color:#555555; line-height:1.6;">์์ฅ ยฑ10% ์ ํฌํธํด๋ฆฌ์ค<br>'
|
| 1856 |
f'<span style="color:#AAAAAA;">์์น +{port_up}%</span> / <span style="color:#E05C5C;">ํ๋ฝ {port_down}%</span> ์์</div>'
|
|
|
|
| 1945 |
base = outlook.get("base", "-")
|
| 1946 |
pess = outlook.get("pessimistic", "-")
|
| 1947 |
notes = [
|
| 1948 |
+
("⚡ ๋ฒ ํ ๊ธฐ๋ฐ", outlook.get("beta_note", "")),
|
| 1949 |
("๐ฏ ์ปจ์ผ์์ค", outlook.get("upside_note", "")),
|
| 1950 |
("๐ ๋ฐธ๋ฅ์์ด์
", outlook.get("valuation_note", "")),
|
| 1951 |
("โ ๏ธ ํต์ฌ ๋ฆฌ์คํฌ", outlook.get("key_risk", "")),
|
|
|
|
| 2018 |
gap_text_color = "#D8D8D8"
|
| 2019 |
gap_label = f"๋ ๋ชฉํ๊ฐ๊ฐ <b>{diff_pct:.0f}%</b> ์ฐจ์ด๋ฉ๋๋ค"
|
| 2020 |
else:
|
| 2021 |
+
gap_icon = "✅"
|
| 2022 |
gap_color = "rgba(255,255,255,0.03)"
|
| 2023 |
gap_border= "rgba(255,255,255,0.10)"
|
| 2024 |
gap_text_color = "#888888"
|
|
|
|
| 2101 |
)
|
| 2102 |
|
| 2103 |
# ============================================================
|
| 2104 |
+
# โ
๊ฐ์ ๋ render_stock_header - ๋ฐฐ์ง ํตํฉ
|
| 2105 |
# ============================================================
|
| 2106 |
def render_stock_header(name, ticker, price, stars, mode_label, has_rich, extra_badges=None):
|
| 2107 |
"""
|
|
|
|
| 2163 |
st.rerun()
|
| 2164 |
|
| 2165 |
# ============================================================
|
| 2166 |
+
# โ
๊ฐ์ ๋ render_owned_report - ํญ 4๊ฐ๋ก ๋ถ๋ฆฌ
|
| 2167 |
# ============================================================
|
| 2168 |
def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
| 2169 |
if not rpt or not isinstance(rpt, dict): return
|
|
|
|
| 2187 |
render_confidence_bar(conf_score, conf_reason)
|
| 2188 |
|
| 2189 |
# โโ ํญ ๋ถ๋ฆฌ: ์์ฝ / ํด์ / ์ก์
/ ๋ชฉํ๊ฐ
|
| 2190 |
+
tab_sum, tab_thesis, tab_action, tab_target = st.tabs(["๐ ์์ฝ", "๐ ํด์", "⚡ ์ก์
", "๐ฏ ๋ชฉํ๊ฐ"])
|
| 2191 |
|
| 2192 |
# โโโโโโโโโโโ ํญ 1: ์์ฝ โโโโโโโโโโโ
|
| 2193 |
with tab_sum:
|
|
|
|
| 2296 |
f'</div>'
|
| 2297 |
f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:12px;">'
|
| 2298 |
f'<div style="background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.10); border-radius:8px; padding:12px;">'
|
| 2299 |
+
f'<div style="font-size:9px; color:#AAAAAA; font-weight:700; margin-bottom:6px; text-transform:uppercase; letter-spacing:1px;">✅ ๊ฐ๋ฅ ์กฐ๊ฑด</div>'
|
| 2300 |
f'<div style="font-size:12px; color:#888888; line-height:1.7;">{condition}</div></div>'
|
| 2301 |
f'<div style="background:rgba(200,60,60,0.08); border:1px solid rgba(212,90,90,0.18); border-radius:8px; padding:12px;">'
|
| 2302 |
f'<div style="font-size:9px; color:#E0E0E0; font-weight:700; margin-bottom:6px; text-transform:uppercase; letter-spacing:1px;">๐ซ ๊ธ์ง ์กฐ๊ฑด</div>'
|
|
|
|
| 2360 |
render_confidence_bar(conf_score, conf_reason)
|
| 2361 |
|
| 2362 |
# โโ ์ค์บ ๋ฆฌํฌํธ๋ ํญ์ผ๋ก ๋ถ๋ฆฌ
|
| 2363 |
+
tab_fit, tab_growth, tab_timing, tab_risk, tab_outlook = st.tabs(["๐ ํฌํธํด๋ฆฌ์ค ์ ํฉ", "๐ก ์ฑ์ฅ ํด์", "โฑ ํ์ด๋ฐ", "! ๋ฆฌ์คํฌ", "📈 ์์ต๋ฅ ์ ๋ง"])
|
| 2364 |
|
| 2365 |
with tab_fit:
|
| 2366 |
pfit = rpt.get("portfolio_fit", {})
|
|
|
|
| 2369 |
st.markdown(
|
| 2370 |
f'<div style="background:rgba(255,255,255,0.04); border:1px solid rgba(201,168,76,0.2); '
|
| 2371 |
f'border-radius:10px; padding:16px; margin-top:12px; margin-bottom:12px;">'
|
| 2372 |
+
f'<div style="font-size:10px; font-weight:700; color:#D8D8D8; letter-spacing:1.5px; text-transform:uppercase; margin-bottom:8px;">⚡ ์ง๊ธ ํฌ์ํด์ผ ํ ์ด๋งค</div>'
|
| 2373 |
f'<div style="font-size:14px; color:#888888; line-height:1.8;">{safe_cat}</div></div>',
|
| 2374 |
unsafe_allow_html=True
|
| 2375 |
)
|
|
|
|
| 2836 |
}}
|
| 2837 |
var s = window.parent._alState;
|
| 2838 |
var CAT = {{
|
| 2839 |
+
'๊ธ๋ณ': {{icon:'⚡', accent:'#D8D8D8', bg:'rgba(255,255,255,0.05)', border:'rgba(255,255,255,0.12)'}},
|
| 2840 |
+
'๋งค์': {{icon:'📈', accent:'#D8D8D8', bg:'rgba(255,255,255,0.05)', border:'rgba(255,255,255,0.12)'}},
|
| 2841 |
+
'์ต์ ': {{icon:'✅', accent:'#AAAAAA', bg:'rgba(255,255,255,0.06)', border:'rgba(255,255,255,0.12)'}},
|
| 2842 |
+
'์คํฑ๋ก์ค':{{icon:'🛑', accent:'#E0E0E0', bg:'rgba(200,60,60,0.08)', border:'rgba(200,60,60,0.20)'}}
|
| 2843 |
}};
|
| 2844 |
function totalCount() {{
|
| 2845 |
var n = 0, keys = ['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค'];
|
|
|
|
| 2865 |
function renderPanel() {{
|
| 2866 |
var cnt = totalCount();
|
| 2867 |
if (s.minimized) {{
|
| 2868 |
+
root.innerHTML = '<div id="al-badge" style="display:flex;align-items:center;gap:10px;background:linear-gradient(135deg,#161616,#111111);border:1px solid rgba(255,255,255,0.17);border-radius:40px;padding:10px 20px;cursor:pointer;box-shadow:0 8px 32px rgba(0,0,0,0.5);animation:alBadgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);user-select:none;"><div style="position:relative;"><span style="font-size:20px;">🔔</span><div style="position:absolute;top:-6px;right:-8px;background:#E0E0E0;color:#fff;border-radius:10px;font-size:10px;font-weight:700;min-width:18px;height:18px;display:flex;align-items:center;justify-content:center;box-shadow:0 0 8px rgba(200,60,60,0.38);">' + cnt + '</div></div><span style="color:#EBEBEB;font-size:13px;font-weight:600;">์๋ ' + cnt + '๊ฐ</span><div style="width:6px;height:6px;border-radius:50%;background:#D8D8D8;animation:alPulse 1.5s infinite;"></div></div>';
|
| 2869 |
pdoc.getElementById('al-badge').onclick = function() {{ s.minimized=false; s.timeLeft=60; renderPanel(); startTimer(); }};
|
| 2870 |
return;
|
| 2871 |
}}
|
|
|
|
| 2880 |
}} else {{
|
| 2881 |
for (var ii=0; ii<items.length; ii++) {{
|
| 2882 |
var item = items[ii];
|
| 2883 |
+
itemHtml += '<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.025);border:1px solid transparent;transition:all 0.18s;animation:alItemIn 0.3s ease '+(ii*0.06)+'s both;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#EBEBEB;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.17);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(201,168,76,0.5);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.14);margin-top:2px;">-> ์์ธ ์ง๋จ</div></div></div>';
|
| 2884 |
}}
|
| 2885 |
}}
|
| 2886 |
+
root.innerHTML = '<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);"><div style="background:linear-gradient(135deg,#1C1C1C,#131313);border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#D8D8D8;box-shadow:0 0 8px rgba(255,255,255,0.40);animation:alPulse 1.5s infinite;"></div><span style="color:#EBEBEB;font-size:13px;font-weight:700;letter-spacing:0.08em;">LIVE ALERTS</span><span style="background:rgba(200,60,60,0.12);border:1px solid rgba(212,90,90,0.25);border-radius:6px;padding:1px 7px;font-size:11px;color:#E0E0E0;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(255,255,255,0.04);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;color:'+(tl>20?'rgba(201,168,76,0.5)':'#E0E0E0')+';font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.16);font-size:18px;padding:4px 8px;border-radius:6px;transition:all 0.2s;line-height:1;">-</button></div></div><div style="display:flex;gap:4px;">'+tabHtml+'</div></div><div style="background:linear-gradient(180deg,#131313,#0C0C0C);border:1px solid rgba(255,255,255,0.08);border-top:2px solid '+cfg.accent+';border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">'+itemHtml+'</div></div>';
|
| 2887 |
pdoc.getElementById('al-minbtn').onclick = function(e) {{ e.stopPropagation(); s.minimized=true; clearInterval(s.timer); renderPanel(); }};
|
| 2888 |
root.querySelectorAll('.al-tab').forEach(function(btn) {{ btn.onclick = function() {{ s.tab = btn.getAttribute('data-tab'); renderPanel(); }}; }});
|
| 2889 |
root.querySelectorAll('.al-item').forEach(function(el) {{ el.onclick = function() {{ gotoTicker(el.getAttribute('data-ticker')); }}; }});
|
|
|
|
| 3105 |
)
|
| 3106 |
if imminent > 0:
|
| 3107 |
summary_html += (
|
| 3108 |
+
f'<span style="background:rgba(200,60,60,0.12);border:1px solid rgba(200,60,60,0.24);border-radius:5px;padding:3px 10px;font-size:11px;font-weight:700;color:#E0E0E0;animation:alertPulse 1.8s ease-in-out infinite;">⚡ {imminent}๊ฑด 7์ผ ์ด๋ด</span>'
|
| 3109 |
)
|
| 3110 |
summary_html += '</div>'
|
| 3111 |
|
|
|
|
| 3113 |
<div style="background:linear-gradient(135deg,#1C1C1C 0%,#111111 100%);border:1px solid rgba(255,255,255,0.09);border-radius:16px;padding:20px;margin-bottom:16px;box-shadow:inset 0 1px 0 rgba(255,255,255,0.05),0 4px 24px rgba(0,0,0,0.4);">
|
| 3114 |
<div style="display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:18px;">
|
| 3115 |
<div>
|
| 3116 |
+
<div style="font-size:10px;font-weight:700;color:#444444;letter-spacing:2px;text-transform:uppercase;margin-bottom:5px;">📅 ์ค์ ๋ฐํ ์บ๋ฆฐ๋ - {label}</div>
|
| 3117 |
<div style="font-size:22px;font-weight:900;color:#EBEBEB;letter-spacing:-0.5px;">{month_name}</div>
|
| 3118 |
</div>
|
| 3119 |
<div style="display:flex;flex-direction:column;gap:5px;align-items:flex-end;padding-top:4px;">{summary_html}</div>
|
|
|
|
| 3223 |
st.markdown("""
|
| 3224 |
<div style="background:linear-gradient(135deg,#1C1C1C 0%,#111111 100%); border:1px solid rgba(255,255,255,0.09); border-radius:14px; padding:28px; margin-bottom:20px;">
|
| 3225 |
<h3 style="color:#EBEBEB; margin-bottom:18px; font-size:18px;">Invest Pro Alpha์ ์ค์ ๊ฑธ ํ์ํฉ๋๋ค</h3>
|
| 3226 |
+
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 1.</b> ์์ฐ ์์ธ ์ง๋จ -> ๋ณด์ ์ข
๋ชฉ ์ถ๊ฐ</div>
|
| 3227 |
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 2.</b> AI ์ค์บ์ผ๋ก ์ค์ฅ๊ธฐ ์ฑ์ฅ์ฃผ ๋ถ์</div>
|
| 3228 |
<div class="onboarding-step"><b style="color:#D8D8D8;">Step 3.</b> ๋งค๋งค ์ผ์ง๋ก ์น๋ฅ ยท์์ต๋น ๋ฐ์ดํฐ ์๊ธฐ</div>
|
| 3229 |
</div>
|
|
|
|
| 3365 |
if _prices:
|
| 3366 |
_zone_top = max(_prices)
|
| 3367 |
if p <= _zone_top:
|
| 3368 |
+
render_price_alert('tp_hit', f"ํ์ฌ๊ฐ {p:,}์ - 1์ฐจ ๋ถํ ๋งค์ ๊ตฌ๊ฐ ์ง์
", tn, n)
|
| 3369 |
elif p <= _zone_top * 1.05:
|
| 3370 |
render_price_alert('tp', f"1์ฐจ ๋ถํ ๋งค์ ๊ตฌ๊ฐ({_zone_top:,}์) ๊ทผ์ ์ค", tn, n)
|
| 3371 |
|
|
|
|
| 3746 |
pc = "#E0E0E0" if pct>=0 else "#9ABBE0"
|
| 3747 |
pa = "โฒ" if pct>=0 else "โผ"
|
| 3748 |
buy_reason = str(row.get('๋งค์๊ทผ๊ฑฐ', '') or '').strip()
|
| 3749 |
+
tgp_val = tgp if tgp != "-" else "-"
|
| 3750 |
|
| 3751 |
with st.container(border=True):
|
| 3752 |
st.markdown('<div class="portfolio-item-row-marker"></div>', unsafe_allow_html=True)
|
|
|
|
| 3997 |
var root = pdoc.getElementById(PID);
|
| 3998 |
if(!root) return;
|
| 3999 |
var CAT = {
|
| 4000 |
+
'๊ธ๋ณ': {icon:'⚡', accent:'#D8D8D8', bg:'rgba(255,255,255,0.05)', border:'rgba(255,255,255,0.12)'},
|
| 4001 |
+
'๋งค์': {icon:'📈', accent:'#D8D8D8', bg:'rgba(255,255,255,0.05)', border:'rgba(255,255,255,0.12)'},
|
| 4002 |
+
'์ต์ ': {icon:'✅', accent:'#AAAAAA', bg:'rgba(255,255,255,0.06)', border:'rgba(255,255,255,0.12)'},
|
| 4003 |
+
'์คํฑ๋ก์ค':{icon:'🛑', accent:'#E0E0E0', bg:'rgba(200,60,60,0.08)', border:'rgba(200,60,60,0.20)'}
|
| 4004 |
};
|
| 4005 |
function totalCount(){ var n=0,keys=['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค']; for(var i=0;i<keys.length;i++) n+=(s.data[keys[i]]||[]).length; return n; }
|
| 4006 |
function gotoTicker(ticker){ window.parent.history.replaceState(null,'','?alert_action=goto:'+ticker); pdoc.querySelectorAll('button').forEach(function(b){ if(b.textContent&&b.textContent.trim()==='alert_trigger') b.click(); }); }
|
| 4007 |
function startTimer(){ if(s.timer) clearInterval(s.timer); if(s.minimized) return; s.timer=setInterval(function(){ s.timeLeft=Math.max(0,s.timeLeft-1); var el=pdoc.getElementById('al-timer-span'); if(el){ el.textContent=s.timeLeft+'s'; el.style.color=s.timeLeft>20?'rgba(201,168,76,0.5)':'#E0E0E0'; } if(s.timeLeft<=0){ clearInterval(s.timer); s.minimized=true; renderPanel(); } },1000); }
|
| 4008 |
function renderPanel(){
|
| 4009 |
var cnt=totalCount();
|
| 4010 |
+
if(s.minimized){ root.innerHTML='<div id="al-badge" style="display:flex;align-items:center;gap:10px;background:linear-gradient(135deg,#161616,#111111);border:1px solid rgba(255,255,255,0.17);border-radius:40px;padding:10px 20px;cursor:pointer;box-shadow:0 8px 32px rgba(0,0,0,0.5);user-select:none;"><div style="position:relative;"><span style="font-size:20px;">🔔</span><div style="position:absolute;top:-6px;right:-8px;background:#E0E0E0;color:#fff;border-radius:10px;font-size:10px;font-weight:700;min-width:18px;height:18px;display:flex;align-items:center;justify-content:center;">'+cnt+'</div></div><span style="color:#EBEBEB;font-size:13px;font-weight:600;">์๋ '+cnt+'๊ฐ</span></div>'; var badge=pdoc.getElementById('al-badge'); if(badge){ badge.onclick=function(){ s.minimized=false; s.timeLeft=60; renderPanel(); startTimer(); }; } return; }
|
| 4011 |
var tab=s.tab,cfg=CAT[tab]||CAT['๊ธ๋ณ'],items=s.data[tab]||[],tl=s.timeLeft;
|
| 4012 |
var tabKeys=['๊ธ๋ณ','๋งค์','์ต์ ','์คํฑ๋ก์ค'],tabHtml='',itemHtml='';
|
| 4013 |
for(var ti=0;ti<tabKeys.length;ti++){
|
|
|
|
| 4019 |
} else {
|
| 4020 |
for(var ii=0;ii<items.length;ii++){
|
| 4021 |
var item=items[ii];
|
| 4022 |
+
itemHtml+='<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.025);border:1px solid transparent;transition:all 0.18s;animation:alItemIn 0.3s ease '+(ii*0.06)+'s both;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#EBEBEB;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.17);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(201,168,76,0.5);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.14);margin-top:2px;">-> ์์ธ ์ง๋จ</div></div></div>';
|
| 4023 |
}
|
| 4024 |
}
|
| 4025 |
+
root.innerHTML='<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);"><div style="background:linear-gradient(135deg,#1C1C1C,#131313);border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#D8D8D8;box-shadow:0 0 8px rgba(255,255,255,0.40);animation:alPulse 1.5s infinite;"></div><span style="color:#EBEBEB;font-size:13px;font-weight:700;letter-spacing:0.08em;">LIVE ALERTS</span><span style="background:rgba(200,60,60,0.12);border:1px solid rgba(212,90,90,0.25);border-radius:6px;padding:1px 7px;font-size:11px;color:#E0E0E0;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(255,255,255,0.04);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.16);font-size:18px;padding:4px 8px;border-radius:6px;transition:all 0.2s;line-height:1;">-</button></div></div><div style="display:flex;gap:4px;">'+tabHtml+'</div></div><div style="background:linear-gradient(180deg,#131313,#0C0C0C);border:1px solid rgba(255,255,255,0.08);border-top:2px solid '+cfg.accent+';border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">'+itemHtml+'</div></div>';
|
| 4026 |
pdoc.getElementById('al-minbtn').onclick=function(e){e.stopPropagation();s.minimized=true;clearInterval(s.timer);renderPanel();};
|
| 4027 |
root.querySelectorAll('.al-tab').forEach(function(btn){btn.onclick=function(){s.tab=btn.getAttribute('data-tab');renderPanel();};});
|
| 4028 |
root.querySelectorAll('.al-item').forEach(function(el){el.onclick=function(){gotoTicker(el.getAttribute('data-ticker'));};});
|