Update src/app.py
Browse files- src/app.py +242 -50
src/app.py
CHANGED
|
@@ -780,10 +780,20 @@ def get_all_prices():
|
|
| 780 |
# ============================================================
|
| 781 |
REPO_ID = "ditgun/my-invest-db"
|
| 782 |
DB_FILE = "my_assets_v30.csv"
|
| 783 |
-
CACHE_FILE = "
|
| 784 |
FAV_FILE = "my_fav_v30.csv"
|
| 785 |
TRADE_FILE = "my_trades_v30.csv"
|
| 786 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 787 |
def _hf_dl(fn):
|
| 788 |
tok = os.getenv("HF_TOKEN")
|
| 789 |
if not tok: return False
|
|
@@ -828,8 +838,30 @@ if 'full_stock_reports' not in st.session_state:
|
|
| 828 |
try:
|
| 829 |
with open(CACHE_FILE, "r", encoding="utf-8") as f:
|
| 830 |
d = json.load(f)
|
| 831 |
-
|
| 832 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 833 |
except:
|
| 834 |
st.session_state.full_stock_reports = {}
|
| 835 |
st.session_state.p_diag_res = None
|
|
@@ -892,6 +924,9 @@ def get_scan_prompt(target, tid="", owned=None, news=None):
|
|
| 892 |
3. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 893 |
4. κ° νλͺ©λ§λ€ κ·Όκ±° λ°μ΄ν° 1κ° μ΄μ λͺ
μ.
|
| 894 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
|
|
|
|
|
|
|
|
|
| 895 |
{news_s}
|
| 896 |
|
| 897 |
[μ€μ λ°μ΄ν°]
|
|
@@ -899,19 +934,22 @@ def get_scan_prompt(target, tid="", owned=None, news=None):
|
|
| 899 |
[μ΄λ―Έ 보μ μ€μΈ μ’
λͺ© β μ€λ³΅ μΆμ² κΈμ§] {owned_s}
|
| 900 |
|
| 901 |
[λΆμ νλͺ© λ° μ°μ μμ]
|
| 902 |
-
1μμ β μ±μ₯ μ§μμ± & ν΄μ
|
| 903 |
-
|
| 904 |
-
μ΄
|
|
|
|
|
|
|
| 905 |
|
| 906 |
-
2μμ β μ€μ₯κΈ° μ§μ
νμ΄λ°:
|
| 907 |
MA50/MA200 μμΉ, 52μ£Ό κ³ μ λλΉ νμ¬ μμΉ κΈ°μ€μΌλ‘ νλ¨.
|
| 908 |
-
λΆν λ§€μ κ΅¬κ° (1μ°¨/2μ°¨)μ μνλ‘ μ μ
|
| 909 |
|
| 910 |
-
3μμ β λ°Έλ₯μμ΄μ
|
| 911 |
-
|
| 912 |
-
|
|
|
|
| 913 |
|
| 914 |
-
4μμ β κΈ°μ μ£Ό 리μ€ν¬ ν€μ§:
|
| 915 |
κΈλ¦¬/κ·μ /μΉν° λ‘ν
μ΄μ
리μ€ν¬κ° μΌλ§λ 컀μ§λκ°?
|
| 916 |
ν€μ§ νμ μ¬λΆμ λ°©λ²μ ꡬ체μ μΌλ‘ μ μ.
|
| 917 |
|
|
@@ -923,7 +961,8 @@ def get_scan_prompt(target, tid="", owned=None, news=None):
|
|
| 923 |
"confidence_score": 0,
|
| 924 |
"confidence_reason": "μ λ’°λ κ·Όκ±°",
|
| 925 |
|
| 926 |
-
"
|
|
|
|
| 927 |
"timing_entry_analysis": "μ€μ₯κΈ° μ§μ
νμ΄λ° λΆμ (2~3λ¬Έμ₯)",
|
| 928 |
"entry_zones": {{
|
| 929 |
"first_buy": "1μ°¨ λΆν λ§€μ μ μ κ°κ²©λ (μν)",
|
|
@@ -964,15 +1003,21 @@ def get_owned_prompt(target, tid="", news=None):
|
|
| 964 |
3. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 965 |
4. λ¨μ μ£Όκ° νλ½μ μμ μ΄μ κ° μλ. μ±μ₯ μ€ν 리 λΆκ΄΄ μ¬λΆλ‘λ§ νλ¨.
|
| 966 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
|
|
|
|
|
|
|
|
|
| 967 |
{news_s}
|
| 968 |
|
| 969 |
[μ€μ λ°μ΄ν° β λ§€μ κ·Όκ±° ν¬ν¨]
|
| 970 |
{target}
|
| 971 |
|
| 972 |
[λΆμ νλͺ© λ° μ°μ μμ]
|
| 973 |
-
1μμ β λ§€μ ν
μ μ ν¨μ±
|
| 974 |
-
|
| 975 |
-
|
|
|
|
|
|
|
|
|
|
| 976 |
|
| 977 |
2μμ β νμ¬ μ‘μ
νλ¨: μ§κΈ νμμΌ νλ, 보μ ν΄μΌ νλ.
|
| 978 |
λ¨, μμ μ λ°λμ ν
μ λΆκ΄΄ μμλ§ κΆκ³ . λ¨μ -10~20% νλ½μ 보μ μ μ§κ° μμΉ.
|
|
@@ -997,7 +1042,9 @@ def get_owned_prompt(target, tid="", news=None):
|
|
| 997 |
"thesis_validity": {{
|
| 998 |
"verdict": "μ ν¨/νΌμ/μ κ²νμ μ€ νλ",
|
| 999 |
"original_thesis": "λ§€μ λΉμ κ·Όκ±° μμ½",
|
| 1000 |
-
"
|
|
|
|
|
|
|
| 1001 |
}},
|
| 1002 |
"action_analysis": "νμ¬ μ‘μ
νλ¨ (3λ¬Έμ₯, μμ κΈ°μ€μ λ°λμ ν
μ λΆκ΄΄ 쑰건μΌλ‘λ§)",
|
| 1003 |
"additional_buy_analysis": {{
|
|
@@ -1037,6 +1084,8 @@ def get_portfolio_prompt(target, owned=None, sector_summary=None, beta_info=None
|
|
| 1037 |
3. μ’
λͺ© κ° κ΄κ³, μΉν° λΆν¬, μκ΄κ΄κ³ λΆμμ μ§μ€ν κ².
|
| 1038 |
4. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 1039 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
|
|
|
|
|
|
| 1040 |
|
| 1041 |
[ν¬νΈν΄λ¦¬μ€ λ°μ΄ν°]
|
| 1042 |
{target}
|
|
@@ -1057,9 +1106,11 @@ def get_portfolio_prompt(target, owned=None, sector_summary=None, beta_info=None
|
|
| 1057 |
3μμ β μ 체 μμ΅λ₯ μ λ§: μ§κΈ ꡬμ±μΌλ‘ 6κ°μ ν κΈ°λ μμ΅μ?
|
| 1058 |
λκ΄/κΈ°λ³Έ/λΉκ΄ 3κ°μ§ μλ리μ€λ‘ κ°λ¨ν μ μ.
|
| 1059 |
|
| 1060 |
-
4μμ β μ§μ€λ κ²½κ³
|
| 1061 |
-
κΈ°μ μ£Ό λΉμ€μ΄ X%μ΄λ©΄ κΈλ¦¬ μΈμ μ ν¬νΈν΄λ¦¬μ€ μ 체 ν격 μμμΉ μ μ.
|
| 1062 |
-
|
|
|
|
|
|
|
| 1063 |
|
| 1064 |
[μΆλ ₯ JSON νμ]
|
| 1065 |
{{
|
|
@@ -1085,7 +1136,8 @@ def get_portfolio_prompt(target, owned=None, sector_summary=None, beta_info=None
|
|
| 1085 |
}},
|
| 1086 |
"concentration_warning": {{
|
| 1087 |
"tech_weight_pct": 0,
|
| 1088 |
-
"
|
|
|
|
| 1089 |
"growth_vs_turnaround": "μ±μ₯μ£Ό vs ν΄μ΄λΌμ΄λ λΉμ¨ νκ°"
|
| 1090 |
}},
|
| 1091 |
"rebalancing_recommendations": [
|
|
@@ -1211,13 +1263,35 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 1211 |
)
|
| 1212 |
|
| 1213 |
# 1μμ: μ±μ₯ μ§μμ± & ν΄μ
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1217 |
st.markdown(
|
| 1218 |
f'<div class="report-section">'
|
| 1219 |
f'<div class="analysis-header">1μμ Β· μ±μ₯ μ§μμ± & ν΄μ</div>'
|
| 1220 |
-
f'
|
| 1221 |
unsafe_allow_html=True
|
| 1222 |
)
|
| 1223 |
|
|
@@ -1337,27 +1411,87 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
|
|
| 1337 |
verdict = thesis.get("verdict", "μ κ²νμ")
|
| 1338 |
orig = thesis.get("original_thesis", "")
|
| 1339 |
curr = thesis.get("current_status", "")
|
| 1340 |
-
verdict_color = {"μ ν¨": "#4ADE80", "νΌμ": "#E53E3E", "μ κ²νμ": "#EAB308"}.get(verdict, "#8B98B4")
|
| 1341 |
-
verdict_bg = {"μ ν¨": "rgba(74,222,128,0.08)", "νΌμ": "rgba(229,62,62,0.08)", "μ κ²νμ": "rgba(234,179,8,0.08)"}.get(verdict, "rgba(255,255,255,0.04)")
|
| 1342 |
-
safe_curr = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(curr).replace('\n','<br>'))
|
| 1343 |
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
| 1355 |
-
|
| 1356 |
-
|
| 1357 |
-
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1361 |
|
| 1362 |
# 2μμ: νμ¬ μ‘μ
|
| 1363 |
action_analysis = rpt.get("action_analysis", "")
|
|
@@ -1550,10 +1684,33 @@ def render_portfolio_report(rpt):
|
|
| 1550 |
# 4μμ: μ§μ€λ κ²½κ³
|
| 1551 |
conc = rpt.get("concentration_warning", {})
|
| 1552 |
if isinstance(conc, dict):
|
| 1553 |
-
tech_w
|
| 1554 |
-
warn_m
|
| 1555 |
-
gvt
|
|
|
|
|
|
|
| 1556 |
tech_color = "#E53E3E" if tech_w >= 70 else ("#EAB308" if tech_w >= 50 else "#4ADE80")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1557 |
st.markdown(
|
| 1558 |
f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
|
| 1559 |
f'border-radius:10px; padding:16px; margin-bottom:14px;">'
|
|
@@ -1566,8 +1723,8 @@ def render_portfolio_report(rpt):
|
|
| 1566 |
f'<div style="background:rgba(255,255,255,0.04); border-radius:6px; height:8px; flex:1;">'
|
| 1567 |
f'<div style="background:{tech_color}; width:{min(tech_w,100)}%; height:8px; border-radius:6px;"></div>'
|
| 1568 |
f'</div></div>'
|
| 1569 |
-
f'
|
| 1570 |
-
f'{"<div style=
|
| 1571 |
f'</div>',
|
| 1572 |
unsafe_allow_html=True
|
| 1573 |
)
|
|
@@ -2317,6 +2474,41 @@ elif st.session_state.main_menu == "β€ μμ° μμΈ μ§λ¨":
|
|
| 2317 |
holding_days = f"{(datetime.now() - bd).days}μΌ"
|
| 2318 |
except: pass
|
| 2319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2320 |
if needs:
|
| 2321 |
with st.spinner(f"{n} 보μ μ’
λͺ© μ§λ¨ μ€..."):
|
| 2322 |
fin_ctx, has_rich = get_rich_financial_context(dt)
|
|
|
|
| 780 |
# ============================================================
|
| 781 |
REPO_ID = "ditgun/my-invest-db"
|
| 782 |
DB_FILE = "my_assets_v30.csv"
|
| 783 |
+
CACHE_FILE = "analysis_cache_v31.json" # v31: λͺ¨λλ³ λΆλ¦¬ ν둬ννΈ κ΅¬μ‘°
|
| 784 |
FAV_FILE = "my_fav_v30.csv"
|
| 785 |
TRADE_FILE = "my_trades_v30.csv"
|
| 786 |
|
| 787 |
+
# μ 보μ μ§λ¨ ꡬ쑰μμ λ°λμ μμ΄μΌ ν νλ
|
| 788 |
+
_NEW_REPORT_FIELDS = {"thesis_validity", "action_analysis", "additional_buy_analysis", "target_remaining"}
|
| 789 |
+
|
| 790 |
+
def _is_new_structure(report: dict) -> bool:
|
| 791 |
+
"""ꡬ ꡬ쑰(target_price, value_growth_analysis λ±)μΈμ§ μ ꡬ쑰μΈμ§ νλ³"""
|
| 792 |
+
if not isinstance(report, dict):
|
| 793 |
+
return False
|
| 794 |
+
# μ ꡬ쑰 νλ μ€ νλλΌλ μμΌλ©΄ μ κ΅¬μ‘°λ‘ νμ
|
| 795 |
+
return bool(_NEW_REPORT_FIELDS & report.keys())
|
| 796 |
+
|
| 797 |
def _hf_dl(fn):
|
| 798 |
tok = os.getenv("HF_TOKEN")
|
| 799 |
if not tok: return False
|
|
|
|
| 838 |
try:
|
| 839 |
with open(CACHE_FILE, "r", encoding="utf-8") as f:
|
| 840 |
d = json.load(f)
|
| 841 |
+
|
| 842 |
+
raw_individual = d.get("individual", {})
|
| 843 |
+
raw_portfolio = d.get("portfolio", None)
|
| 844 |
+
|
| 845 |
+
# ββ ꡬ ꡬ쑰 μΊμ μλ 무ν¨ν βββββββββββββββββββββββββ
|
| 846 |
+
cleaned = {}
|
| 847 |
+
purged = 0
|
| 848 |
+
for key, val in raw_individual.items():
|
| 849 |
+
rpt = val.get("report", {}) if isinstance(val, dict) else {}
|
| 850 |
+
if _is_new_structure(rpt):
|
| 851 |
+
cleaned[key] = val
|
| 852 |
+
else:
|
| 853 |
+
purged += 1
|
| 854 |
+
|
| 855 |
+
st.session_state.full_stock_reports = cleaned
|
| 856 |
+
|
| 857 |
+
if raw_portfolio and _is_new_structure(raw_portfolio):
|
| 858 |
+
st.session_state.p_diag_res = raw_portfolio
|
| 859 |
+
else:
|
| 860 |
+
st.session_state.p_diag_res = None
|
| 861 |
+
|
| 862 |
+
if purged > 0:
|
| 863 |
+
st.toast(f"λΆμ ꡬ쑰 μ
λ°μ΄νΈ: {purged}κ° μ’
λͺ©μ μ¬λΆμν©λλ€.", icon="π")
|
| 864 |
+
|
| 865 |
except:
|
| 866 |
st.session_state.full_stock_reports = {}
|
| 867 |
st.session_state.p_diag_res = None
|
|
|
|
| 924 |
3. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 925 |
4. κ° νλͺ©λ§λ€ κ·Όκ±° λ°μ΄ν° 1κ° μ΄μ λͺ
μ.
|
| 926 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
| 927 |
+
6. μ λ(μ«μ) κ·Όκ±°μ μ μ±(νλ¨) κ·Όκ±°λ₯Ό λ°λμ λΆλ¦¬ν΄μ μ μ.
|
| 928 |
+
μ λ: λ§€μΆμ±μ₯λ₯ , μμ
μ΄μ΅λ₯ , PER, λΆμ±λΉμ¨ λ± μ€μ μμΉ
|
| 929 |
+
μ μ±: κΈ°μ ν΄μ, λΈλλ, κ²½μμ§ μ λ’°λ, μμ₯ ν¬μ§μ
λ³ν λ± νλ¨ κ·Όκ±°
|
| 930 |
{news_s}
|
| 931 |
|
| 932 |
[μ€μ λ°μ΄ν°]
|
|
|
|
| 934 |
[μ΄λ―Έ 보μ μ€μΈ μ’
λͺ© β μ€λ³΅ μΆμ² κΈμ§] {owned_s}
|
| 935 |
|
| 936 |
[λΆμ νλͺ© λ° μ°μ μμ]
|
| 937 |
+
1μμ β μ±μ₯ μ§μμ± & ν΄μ (μ λ + μ μ± λΆλ¦¬ νμ):
|
| 938 |
+
[μ λ] λ§€μΆ/μμ
μ΄μ΅ μ±μ₯λ₯ , λ§€μΆμ΄μ΄μ΅λ₯ μΆμ΄, R&D ν¬μ λΉμ€
|
| 939 |
+
[μ μ±] μ΄ νμ¬λ§ κ°μ§ κΈ°μ /νΉν/λ€νΈμν¬ ν¨κ³Όκ° μ€μ λ‘ μλκ°?
|
| 940 |
+
κ²½μμκ° 6κ°μ~1λ
μμ λ°λΌμ¬ μ μλ ꡬ쑰μ μ΄μ λ 무μμΈκ°?
|
| 941 |
+
μ΄κ²μ΄ μ±μ₯μ£ΌμΈκ°, ν΄μ΄λΌμ΄λμ£ΌμΈκ° λͺ
νν ꡬλΆ.
|
| 942 |
|
| 943 |
+
2μμ β μ€μ₯κΈ° μ§μ
νμ΄λ°:
|
| 944 |
MA50/MA200 μμΉ, 52μ£Ό κ³ μ λλΉ νμ¬ μμΉ κΈ°μ€μΌλ‘ νλ¨.
|
| 945 |
+
λΆν λ§€μ κ΅¬κ° (1μ°¨/2μ°¨)μ μνλ‘ μ μ.
|
| 946 |
|
| 947 |
+
3μμ β λ°Έλ₯μμ΄μ
(μ λ + μ μ± λΆλ¦¬ νμ):
|
| 948 |
+
[μ λ] PER, PEG, PSR λ± μ€μ μμΉ κΈ°λ°
|
| 949 |
+
[μ μ±] μ΄ ν리미μμ΄ μ λΉνκ°? μμ₯μ΄ μ΄ νμ¬μ μ΄λ€ κ°μΉλ₯Ό λ―Ώκ³ μλκ°?
|
| 950 |
+
κ³ PERμ΄μ΄λ μ±μ₯λ₯ μ΄ λ·λ°μΉ¨λλ©΄ ν©λ¦¬μ μμ λͺ
μ.
|
| 951 |
|
| 952 |
+
4μμ β κΈ°μ μ£Ό 리μ€ν¬ ν€μ§:
|
| 953 |
κΈλ¦¬/κ·μ /μΉν° λ‘ν
μ΄μ
리μ€ν¬κ° μΌλ§λ 컀μ§λκ°?
|
| 954 |
ν€μ§ νμ μ¬λΆμ λ°©λ²μ ꡬ체μ μΌλ‘ μ μ.
|
| 955 |
|
|
|
|
| 961 |
"confidence_score": 0,
|
| 962 |
"confidence_reason": "μ λ’°λ κ·Όκ±°",
|
| 963 |
|
| 964 |
+
"growth_moat_quantitative": "μ λ κ·Όκ±°: λ§€μΆμ±μ₯λ₯ , μμ
μ΄μ΅λ₯ , R&DλΉμ€ λ± μ€μ μμΉ μ€μ¬ λΆμ (2~3λ¬Έμ₯)",
|
| 965 |
+
"growth_moat_qualitative": "μ μ± κ·Όκ±°: κΈ°μ ν΄μ, νΉν, λ€νΈμν¬ν¨κ³Ό, κ²½μμ§ μ λ’°λ, μμ₯ν¬μ§μ
λ³ν λ± νλ¨ μ€μ¬ λΆμ (2~3λ¬Έμ₯, μ±μ₯μ£Ό/ν΄μ΄λΌμ΄λ κ΅¬λΆ λͺ
μ)",
|
| 966 |
"timing_entry_analysis": "μ€μ₯κΈ° μ§μ
νμ΄λ° λΆμ (2~3λ¬Έμ₯)",
|
| 967 |
"entry_zones": {{
|
| 968 |
"first_buy": "1μ°¨ λΆν λ§€μ μ μ κ°κ²©λ (μν)",
|
|
|
|
| 1003 |
3. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 1004 |
4. λ¨μ μ£Όκ° νλ½μ μμ μ΄μ κ° μλ. μ±μ₯ μ€ν 리 λΆκ΄΄ μ¬λΆλ‘λ§ νλ¨.
|
| 1005 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
| 1006 |
+
6. ν
μ μ ν¨μ± νλ¨ μ μ λ(μ«μ λ³ν)κ³Ό μ μ±(ꡬ쑰 λ³ν) κ·Όκ±°λ₯Ό λ°λμ λΆλ¦¬.
|
| 1007 |
+
μ λ: μ±μ₯λ₯ κΊΎμ, μ΄μ΅λ₯ νλ½, λΆμ± μ¦κ° λ± μμΉ λ³ν
|
| 1008 |
+
μ μ±: κ²½μ ꡬλ λ³ν, κ²½μμ§ μ λ΅ μ ν, ν΅μ¬ μΈλ¬Ό μ΄ν, μμ₯ μ λ’° λ³ν
|
| 1009 |
{news_s}
|
| 1010 |
|
| 1011 |
[μ€μ λ°μ΄ν° β λ§€μ κ·Όκ±° ν¬ν¨]
|
| 1012 |
{target}
|
| 1013 |
|
| 1014 |
[λΆμ νλͺ© λ° μ°μ μμ]
|
| 1015 |
+
1μμ β λ§€μ ν
μ μ ν¨μ± (μ λ + μ μ± λΆλ¦¬ νμ):
|
| 1016 |
+
μμ [λ§€μ λΉμ κ·Όκ±°]μ μ§κΈ μν©μ μ§μ λμ‘°νλ€.
|
| 1017 |
+
[μ λ] μ±μ₯λ₯ μ΄ κΊΎμλκ°? μμ
μ΄μ΅λ₯ μ΄ νλ½νλκ°? μ€μ μμΉλ‘ νμΈ.
|
| 1018 |
+
[μ μ±] ν΄μκ° νΌμλλκ°? κ²½μ ꡬλκ° λ°λμλκ°? κ²½μμ§ μ λ΅μ΄ μ ννλκ°?
|
| 1019 |
+
μμ₯μμ μ΄ νμ¬μ λν μ λ’°κ° μ μ§λκ³ μλκ°?
|
| 1020 |
+
ν
μ κ° μ΄μμμΌλ©΄ "μ ν¨", νΌμλμΌλ©΄ "νΌμ", μ λ§€νλ©΄ "μ κ²νμ"λ‘ νμ .
|
| 1021 |
|
| 1022 |
2μμ β νμ¬ μ‘μ
νλ¨: μ§κΈ νμμΌ νλ, 보μ ν΄μΌ νλ.
|
| 1023 |
λ¨, μμ μ λ°λμ ν
μ λΆκ΄΄ μμλ§ κΆκ³ . λ¨μ -10~20% νλ½μ 보μ μ μ§κ° μμΉ.
|
|
|
|
| 1042 |
"thesis_validity": {{
|
| 1043 |
"verdict": "μ ν¨/νΌμ/μ κ²νμ μ€ νλ",
|
| 1044 |
"original_thesis": "λ§€μ λΉμ κ·Όκ±° μμ½",
|
| 1045 |
+
"quantitative_check": "μ λ μ κ²: μ±μ₯λ₯ Β·μ΄μ΅λ₯ Β·λΆμ± λ± μμΉ λ³ν (2~3λ¬Έμ₯, μ€μ μ«μ λͺ
μ)",
|
| 1046 |
+
"qualitative_check": "μ μ± μ κ²: κ²½μꡬλΒ·κ²½μμ§Β·ν΄μΒ·μμ₯μ λ’° λ³ν (2~3λ¬Έμ₯)",
|
| 1047 |
+
"current_status": "μ΅μ’
νμ μμ½: μ μ λ+μ μ±μ μ’
ν©ν΄ ν
μ κ° μ΄λ€ μνμΈμ§ (2λ¬Έμ₯)"
|
| 1048 |
}},
|
| 1049 |
"action_analysis": "νμ¬ μ‘μ
νλ¨ (3λ¬Έμ₯, μμ κΈ°μ€μ λ°λμ ν
μ λΆκ΄΄ 쑰건μΌλ‘λ§)",
|
| 1050 |
"additional_buy_analysis": {{
|
|
|
|
| 1084 |
3. μ’
λͺ© κ° κ΄κ³, μΉν° λΆν¬, μκ΄κ΄κ³ λΆμμ μ§μ€ν κ².
|
| 1085 |
4. μ€νμλ μ΄ν΄ν μ μλ μ¬μ΄ λ§λ‘ μμ±.
|
| 1086 |
5. μμ JSONλ§ μΆλ ₯. λ§ν¬λ€μ΄ κΈ°νΈ κΈμ§.
|
| 1087 |
+
6. μΉν°κ° λ¬λΌλ λμΌ ν
λ§(μ: AI μν, κΈλ¦¬ λ―Όκ°)μ λ¬ΆμΈ μ’
λͺ©μ λ°λμ μλ³.
|
| 1088 |
+
μ λ μ§μ€λ(μΉν° λΉμ€ %)μ μ μ± μ§μ€λ(ν
λ§ μ€λ³΅)λ₯Ό λͺ¨λ μ§λ¨ν κ².
|
| 1089 |
|
| 1090 |
[ν¬νΈν΄λ¦¬μ€ λ°μ΄ν°]
|
| 1091 |
{target}
|
|
|
|
| 1106 |
3μμ β μ 체 μμ΅λ₯ μ λ§: μ§κΈ ꡬμ±μΌλ‘ 6κ°μ ν κΈ°λ μμ΅μ?
|
| 1107 |
λκ΄/κΈ°λ³Έ/λΉκ΄ 3κ°μ§ μλ리μ€λ‘ κ°λ¨ν μ μ.
|
| 1108 |
|
| 1109 |
+
4μμ β μ§μ€λ κ²½κ³ (μ λ + μ μ± λΆλ¦¬ νμ):
|
| 1110 |
+
[μ λ] κΈ°μ μ£Ό λΉμ€μ΄ X%μ΄λ©΄ κΈλ¦¬ μΈμ μ ν¬νΈν΄λ¦¬μ€ μ 체 ν격 μμμΉ μ μ.
|
| 1111 |
+
μ±μ₯μ£Ό vs ν΄μ΄λΌμ΄λ λΉμ¨λ μμΉλ‘ μ κ².
|
| 1112 |
+
[μ μ±] μΉν°λ λ¬λΌλ μ€μ§μ μΌλ‘ κ°μ ν
λ§(AI μνΒ·κΈλ¦¬ λ―Όκ°Β·μ€κ΅ μ΅μ€ν¬μ λ±)μ
|
| 1113 |
+
λ¬ΆμΈ μ’
λͺ©λ€μ μλ³. μ«μλ‘λ λΆμ°λΌ 보μ¬λ μ€μ λ‘λ μ§μ€μΈ κ²½μ°λ₯Ό λ°λμ μ§μ κ².
|
| 1114 |
|
| 1115 |
[μΆλ ₯ JSON νμ]
|
| 1116 |
{{
|
|
|
|
| 1136 |
}},
|
| 1137 |
"concentration_warning": {{
|
| 1138 |
"tech_weight_pct": 0,
|
| 1139 |
+
"quantitative_concentration": "μ λ μ§μ€λ: μΉν°λ³ λΉμ€ % λ° κΈλ¦¬ μΈμ μ μμ ν격 (2λ¬Έμ₯)",
|
| 1140 |
+
"qualitative_concentration": "μ μ± μ§μ€λ: μΉν°κ° λ¬λΌλ μ€μ§ κ°μ ν
λ§μ λ¬ΆμΈ μ’
λͺ© μλ³ (2~3λ¬Έμ₯)",
|
| 1141 |
"growth_vs_turnaround": "μ±μ₯μ£Ό vs ν΄μ΄λΌμ΄λ λΉμ¨ νκ°"
|
| 1142 |
}},
|
| 1143 |
"rebalancing_recommendations": [
|
|
|
|
| 1263 |
)
|
| 1264 |
|
| 1265 |
# 1μμ: μ±μ₯ μ§μμ± & ν΄μ
|
| 1266 |
+
growth_quant = rpt.get("growth_moat_quantitative", "")
|
| 1267 |
+
growth_qual = rpt.get("growth_moat_qualitative", "")
|
| 1268 |
+
# ꡬλ²μ μΊμ νΈν
|
| 1269 |
+
if not growth_quant and not growth_qual:
|
| 1270 |
+
growth_quant = rpt.get("growth_moat_analysis", "")
|
| 1271 |
+
if growth_quant or growth_qual:
|
| 1272 |
+
safe_q = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(growth_quant).replace('\n','<br>'))
|
| 1273 |
+
safe_ql = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(growth_qual).replace('\n','<br>'))
|
| 1274 |
+
inner = ""
|
| 1275 |
+
if safe_q:
|
| 1276 |
+
inner += (
|
| 1277 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
|
| 1278 |
+
f'<div style="font-size:9px; color:#4A5568; margin-bottom:6px; text-transform:uppercase; '
|
| 1279 |
+
f'letter-spacing:1.5px;">π μ λ κ·Όκ±°</div>'
|
| 1280 |
+
f'<div class="analysis-content" style="margin:0;">{safe_q}</div>'
|
| 1281 |
+
f'</div>'
|
| 1282 |
+
)
|
| 1283 |
+
if safe_ql:
|
| 1284 |
+
inner += (
|
| 1285 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px;">'
|
| 1286 |
+
f'<div style="font-size:9px; color:#8B98B4; margin-bottom:6px; text-transform:uppercase; '
|
| 1287 |
+
f'letter-spacing:1.5px;">π‘ μ μ± νλ¨</div>'
|
| 1288 |
+
f'<div class="analysis-content" style="margin:0;">{safe_ql}</div>'
|
| 1289 |
+
f'</div>'
|
| 1290 |
+
)
|
| 1291 |
st.markdown(
|
| 1292 |
f'<div class="report-section">'
|
| 1293 |
f'<div class="analysis-header">1μμ Β· μ±μ₯ μ§μμ± & ν΄μ</div>'
|
| 1294 |
+
f'{inner}</div>',
|
| 1295 |
unsafe_allow_html=True
|
| 1296 |
)
|
| 1297 |
|
|
|
|
| 1411 |
verdict = thesis.get("verdict", "μ κ²νμ")
|
| 1412 |
orig = thesis.get("original_thesis", "")
|
| 1413 |
curr = thesis.get("current_status", "")
|
|
|
|
|
|
|
|
|
|
| 1414 |
|
| 1415 |
+
# ββ B. λ§€μ κ·Όκ±° λ―ΈκΈ°λ‘ β "νμΈ λΆκ°" μν λΆλλ¬μ΄ μλ΄ ββ
|
| 1416 |
+
no_reason = (not orig or "λ―ΈκΈ°λ‘" in orig or "νμΈ λΆκ°" in orig)
|
| 1417 |
+
if no_reason:
|
| 1418 |
+
st.markdown(
|
| 1419 |
+
'<div style="background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); '
|
| 1420 |
+
'border-radius:12px; padding:20px; margin-bottom:14px;">'
|
| 1421 |
+
'<div style="display:flex; align-items:center; gap:10px; margin-bottom:12px;">'
|
| 1422 |
+
'<div class="analysis-header" style="margin-bottom:0;">1μμ Β· λ§€μ ν
μ μ ν¨μ±</div>'
|
| 1423 |
+
'<span style="font-size:12px; font-weight:700; color:#4A5568; '
|
| 1424 |
+
'background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); '
|
| 1425 |
+
'padding:3px 12px; border-radius:20px;">κ·Όκ±° λ―ΈκΈ°λ‘</span>'
|
| 1426 |
+
'</div>'
|
| 1427 |
+
'<div style="font-size:14px; color:#8B98B4; line-height:1.9; margin-bottom:14px;">'
|
| 1428 |
+
'λ§€μ λΉμ μκ°μ κΈ°λ‘ν΄λλ©΄ <b style="color:#EEF2F7;">μ§κΈ οΏ½οΏ½ μ΄μ κ° μ΄μμλμ§</b>λ₯Ό '
|
| 1429 |
+
'μ ννκ² νλ¨ν΄λ릴 μ μμ΄μ.<br>'
|
| 1430 |
+
'μ¬λ¬΄ λ°μ΄ν° κΈ°λ° λΆμμ μλμμ νμΈνμ€ μ μμ§λ§, '
|
| 1431 |
+
'"λ΄κ° μ μλκ°"μμ λΉκ΅λ μ΄λ² λΆμμμ λΉ μ‘μ΅λλ€.'
|
| 1432 |
+
'</div>'
|
| 1433 |
+
'<div style="font-size:12px; color:#4A5568; '
|
| 1434 |
+
'background:rgba(201,168,76,0.04); border:1px solid rgba(201,168,76,0.12); '
|
| 1435 |
+
'border-radius:8px; padding:10px 14px;">'
|
| 1436 |
+
'π‘ ν¬νΈν΄λ¦¬μ€ λͺ©λ‘μμ <b style="color:#C9A84C;">β νΈμ§</b>μ λλ¬ λ§€μ κ·Όκ±°λ₯Ό μΆκ°νλ©΄, '
|
| 1437 |
+
'λ€μ λΆμλΆν° ν
μ μ ν¨μ±μ μ ννκ² νλ¨ν μ μμ΄μ.'
|
| 1438 |
+
'</div>'
|
| 1439 |
+
'</div>',
|
| 1440 |
+
unsafe_allow_html=True
|
| 1441 |
+
)
|
| 1442 |
+
else:
|
| 1443 |
+
verdict_color = {"μ ν¨": "#4ADE80", "νΌμ": "#E53E3E", "μ κ²νμ": "#EAB308"}.get(verdict, "#8B98B4")
|
| 1444 |
+
verdict_bg = {"μ ν¨": "rgba(74,222,128,0.08)", "νΌμ": "rgba(229,62,62,0.08)", "μ κ²νμ": "rgba(234,179,8,0.08)"}.get(verdict, "rgba(255,255,255,0.04)")
|
| 1445 |
+
quant_chk = thesis.get("quantitative_check", "")
|
| 1446 |
+
qual_chk = thesis.get("qualitative_check", "")
|
| 1447 |
+
safe_curr = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(curr).replace('\n','<br>'))
|
| 1448 |
+
safe_qn = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(quant_chk).replace('\n','<br>'))
|
| 1449 |
+
safe_ql = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(qual_chk).replace('\n','<br>'))
|
| 1450 |
+
|
| 1451 |
+
# μ λ/μ μ± λΆλ¦¬ λΈλ‘
|
| 1452 |
+
check_blocks = ""
|
| 1453 |
+
if safe_qn:
|
| 1454 |
+
check_blocks += (
|
| 1455 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
|
| 1456 |
+
f'<div style="font-size:9px; color:#4A5568; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">π μ λ μ κ²</div>'
|
| 1457 |
+
f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_qn}</div>'
|
| 1458 |
+
f'</div>'
|
| 1459 |
+
)
|
| 1460 |
+
if safe_ql:
|
| 1461 |
+
check_blocks += (
|
| 1462 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
|
| 1463 |
+
f'<div style="font-size:9px; color:#8B98B4; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">π‘ μ μ± μ κ²</div>'
|
| 1464 |
+
f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_ql}</div>'
|
| 1465 |
+
f'</div>'
|
| 1466 |
+
)
|
| 1467 |
+
# μ λ/μ μ± μμΌλ©΄ κΈ°μ‘΄ current_status κ·Έλλ‘ (ꡬλ²μ μΊμ νΈν)
|
| 1468 |
+
if not check_blocks:
|
| 1469 |
+
check_blocks = f'<div style="font-size:14px; color:#8B98B4; line-height:1.8;">{safe_curr}</div>'
|
| 1470 |
+
else:
|
| 1471 |
+
check_blocks += (
|
| 1472 |
+
f'<div style="background:rgba(0,0,0,0.15); border-radius:8px; padding:10px 12px; margin-top:4px;">'
|
| 1473 |
+
f'<div style="font-size:9px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1.5px;">βοΈ μ’
ν© νμ </div>'
|
| 1474 |
+
f'<div style="font-size:13px; color:#EEF2F7; line-height:1.7; font-weight:500;">{safe_curr}</div>'
|
| 1475 |
+
f'</div>'
|
| 1476 |
+
)
|
| 1477 |
+
|
| 1478 |
+
st.markdown(
|
| 1479 |
+
f'<div style="background:{verdict_bg}; border:1px solid {verdict_color}33; '
|
| 1480 |
+
f'border-radius:12px; padding:20px; margin-bottom:14px;">'
|
| 1481 |
+
f'<div style="display:flex; align-items:center; gap:10px; margin-bottom:14px;">'
|
| 1482 |
+
f'<div class="analysis-header" style="margin-bottom:0;">1μμ Β· λ§€μ ν
μ μ ν¨μ±</div>'
|
| 1483 |
+
f'<span style="font-size:13px; font-weight:900; color:{verdict_color}; '
|
| 1484 |
+
f'background:{verdict_bg}; border:1px solid {verdict_color}55; '
|
| 1485 |
+
f'padding:3px 12px; border-radius:20px;">{verdict}</span>'
|
| 1486 |
+
f'</div>'
|
| 1487 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:10px;">'
|
| 1488 |
+
f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">λ§€μ λΉμ κ·Όκ±°</div>'
|
| 1489 |
+
f'<div style="font-size:13px; color:#8B98B4;">{orig}</div>'
|
| 1490 |
+
f'</div>'
|
| 1491 |
+
f'{check_blocks}'
|
| 1492 |
+
f'</div>',
|
| 1493 |
+
unsafe_allow_html=True
|
| 1494 |
+
)
|
| 1495 |
|
| 1496 |
# 2μμ: νμ¬ μ‘μ
|
| 1497 |
action_analysis = rpt.get("action_analysis", "")
|
|
|
|
| 1684 |
# 4μμ: μ§μ€λ κ²½κ³
|
| 1685 |
conc = rpt.get("concentration_warning", {})
|
| 1686 |
if isinstance(conc, dict):
|
| 1687 |
+
tech_w = conc.get("tech_weight_pct", 0)
|
| 1688 |
+
warn_m = conc.get("warning_message", "")
|
| 1689 |
+
gvt = conc.get("growth_vs_turnaround", "")
|
| 1690 |
+
qn_conc = conc.get("quantitative_concentration", "")
|
| 1691 |
+
ql_conc = conc.get("qualitative_concentration", "")
|
| 1692 |
tech_color = "#E53E3E" if tech_w >= 70 else ("#EAB308" if tech_w >= 50 else "#4ADE80")
|
| 1693 |
+
|
| 1694 |
+
conc_detail = ""
|
| 1695 |
+
if qn_conc:
|
| 1696 |
+
safe_qn = qn_conc.replace("\n","<br>")
|
| 1697 |
+
conc_detail += (
|
| 1698 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
|
| 1699 |
+
f'<div style="font-size:9px; color:#4A5568; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">π μ λ μ§μ€λ</div>'
|
| 1700 |
+
f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_qn}</div>'
|
| 1701 |
+
f'</div>'
|
| 1702 |
+
)
|
| 1703 |
+
if ql_conc:
|
| 1704 |
+
safe_ql = ql_conc.replace("\n","<br>")
|
| 1705 |
+
conc_detail += (
|
| 1706 |
+
f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
|
| 1707 |
+
f'<div style="font-size:9px; color:#8B98B4; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">π‘ μ μ± μ§μ€λ (ν
λ§ μ€λ³΅)</div>'
|
| 1708 |
+
f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_ql}</div>'
|
| 1709 |
+
f'</div>'
|
| 1710 |
+
)
|
| 1711 |
+
if not conc_detail and warn_m:
|
| 1712 |
+
conc_detail = f'<div style="font-size:13px; color:#8B98B4; margin-bottom:8px;">{warn_m}</div>'
|
| 1713 |
+
|
| 1714 |
st.markdown(
|
| 1715 |
f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
|
| 1716 |
f'border-radius:10px; padding:16px; margin-bottom:14px;">'
|
|
|
|
| 1723 |
f'<div style="background:rgba(255,255,255,0.04); border-radius:6px; height:8px; flex:1;">'
|
| 1724 |
f'<div style="background:{tech_color}; width:{min(tech_w,100)}%; height:8px; border-radius:6px;"></div>'
|
| 1725 |
f'</div></div>'
|
| 1726 |
+
f'{conc_detail}'
|
| 1727 |
+
f'{"<div style='background:#080C14;border-radius:6px;padding:8px 12px;font-size:12px;color:#8B98B4;'><b style='color:#4A5568;'>μ±μ₯μ£Ό vs ν΄μ΄λΌμ΄λ Β· </b>" + gvt + "</div>" if gvt else ""}'
|
| 1728 |
f'</div>',
|
| 1729 |
unsafe_allow_html=True
|
| 1730 |
)
|
|
|
|
| 2474 |
holding_days = f"{(datetime.now() - bd).days}μΌ"
|
| 2475 |
except: pass
|
| 2476 |
|
| 2477 |
+
# ββ A. λ§€μ κ·Όκ±° μμ λ μ
λ ₯ μ λ (λΆμμ κ³μ μ§ν) ββββββ
|
| 2478 |
+
buy_reason_pre = str(row.get('λ§€μκ·Όκ±°', '') or '').strip()
|
| 2479 |
+
if not buy_reason_pre and not st.session_state.get(f"reason_skip_{ukey}", False):
|
| 2480 |
+
st.markdown(
|
| 2481 |
+
'<div style="background:rgba(201,168,76,0.06); border:1px solid rgba(201,168,76,0.25); '
|
| 2482 |
+
'border-radius:10px; padding:16px 18px; margin-bottom:14px;">'
|
| 2483 |
+
'<div style="font-size:11px; font-weight:700; color:#C9A84C; letter-spacing:1.5px; '
|
| 2484 |
+
'text-transform:uppercase; margin-bottom:8px;">βοΈ λ§€μ κ·Όκ±° λ―ΈκΈ°λ‘</div>'
|
| 2485 |
+
'<div style="font-size:13px; color:#8B98B4; line-height:1.8; margin-bottom:12px;">'
|
| 2486 |
+
'λ§€μ λΉμ μκ°μ μ μ΄λλ©΄ <b style="color:#EEF2F7;">ν
μ μ ν¨μ±</b>μ μ ννκ² νλ¨ν μ μμ΄μ.<br>'
|
| 2487 |
+
'μ§κΈ μ
λ ₯νμ§ μμλ λΆμμ λ°λ‘ μ§νλμ§λ§, κΈ°λ‘μ΄ μμΌλ©΄ "μ μλκ°" λΉκ΅κ° λΉ μ§λλ€.'
|
| 2488 |
+
'</div>'
|
| 2489 |
+
'</div>',
|
| 2490 |
+
unsafe_allow_html=True
|
| 2491 |
+
)
|
| 2492 |
+
reason_col1, reason_col2 = st.columns([0.75, 0.25], vertical_alignment="bottom")
|
| 2493 |
+
with reason_col1:
|
| 2494 |
+
inline_reason = st.text_input(
|
| 2495 |
+
"λ§€μ κ·Όκ±° (μ ν)",
|
| 2496 |
+
placeholder="μ: AI μμ£Ό λͺ¨λ©ν
/ MA50 μ§μ§ νμΈ / μ νκ° κ΅¬κ° λΆν λ§€μ",
|
| 2497 |
+
key=f"inline_reason_{ukey}"
|
| 2498 |
+
)
|
| 2499 |
+
with reason_col2:
|
| 2500 |
+
if st.button("μ μ₯ ν λΆμ", key=f"save_reason_{ukey}", type="primary", use_container_width=True):
|
| 2501 |
+
if inline_reason.strip():
|
| 2502 |
+
idx_r = st.session_state.df[st.session_state.df['ν°μ»€'] == dt].index[0]
|
| 2503 |
+
st.session_state.df.at[idx_r, 'λ§€μκ·Όκ±°'] = inline_reason.strip()
|
| 2504 |
+
save_assets()
|
| 2505 |
+
st.session_state[f"reason_skip_{ukey}"] = True
|
| 2506 |
+
st.rerun()
|
| 2507 |
+
if st.button("κ·Όκ±° μμ΄ λ°λ‘ λΆμ", key=f"skip_reason_{ukey}", use_container_width=False):
|
| 2508 |
+
st.session_state[f"reason_skip_{ukey}"] = True
|
| 2509 |
+
st.rerun()
|
| 2510 |
+
st.stop()
|
| 2511 |
+
|
| 2512 |
if needs:
|
| 2513 |
with st.spinner(f"{n} 보μ μ’
λͺ© μ§λ¨ μ€..."):
|
| 2514 |
fin_ctx, has_rich = get_rich_financial_context(dt)
|