From 1f551519fdca2c87e9a0e181fd8ee269f57f48bf Mon Sep 17 00:00:00 2001 From: ILSEON-RYU Date: Wed, 29 Apr 2026 18:33:03 +0900 Subject: [PATCH] =?UTF-8?q?StochRSI=20K=EC=84=A0=20=EB=B9=A8=EA=B0=84=20?= =?UTF-8?q?=EC=8B=A4=EC=84=A0=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_streamlit.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app_streamlit.py b/app_streamlit.py index 7286442..ee37335 100644 --- a/app_streamlit.py +++ b/app_streamlit.py @@ -66,8 +66,8 @@ def send_telegram(message: str): def check_and_alert(df, symbol, interval): now = time.time() - recent = df.iloc[-3:] # 마지막 3개 캔들 체크 - for sig, key, msg_base in [ + last = df.iloc[-1] + for sig, key, msg in [ ("strong_long_signal", "strong_long", f"🟢 강한 롱 진입 신호\n{symbol} {interval}"), ("strong_short_signal", "strong_short", f"🔴 강한 숏 진입 신호\n{symbol} {interval}"), ("long_signal", "long", f"🔼 롱 진입 신호\n{symbol} {interval}"), @@ -76,12 +76,7 @@ def check_and_alert(df, symbol, interval): ("vol_short_signal", "vol_short", f"🔽 볼륨급등 숏 신호\n{symbol} {interval}"), ("short_caution_signal","short_caution",f"⚠️ 숏 진입 주의 신호\n{symbol} {interval}"), ]: - if sig in recent.columns and recent[sig].any() and now - _last_alert[key] > ALERT_COOLDOWN: - sig_row = recent[recent[sig] == True].iloc[-1] - sig_time = sig_row["open_time"].strftime("%H:%M") if "open_time" in sig_row else "" - price = f"{sig_row['close']:,.1f}" if "close" in sig_row else "" - msg = f"{msg_base}\n시간: {sig_time} 가격: {price}" - print(f"[알림발송] {msg_base.split(chr(10))[0]} | {sig_time} | {price}") + if last.get(sig, False) and now - _last_alert[key] > ALERT_COOLDOWN: send_telegram(msg) _last_alert[key] = now @@ -455,7 +450,7 @@ def build_chart(symbol, interval, candle_limit=200): fig.add_hline(y=1.0, line=dict(color=COLORS["grid"], width=0.8, dash="dash"), row=5, col=1) fig.add_trace(go.Scatter(x=t, y=df["RSI"], line=dict(color=COLORS["blue"], width=1.5), name="RSI(14)"), row=6, col=1) - fig.add_trace(go.Scatter(x=t, y=df["StochRSI_k"],line=dict(color=COLORS["yellow"], width=1.2, dash="dot"), name="StochRSI K"), row=6, col=1) + fig.add_trace(go.Scatter(x=t, y=df["StochRSI_k"],line=dict(color=COLORS["red"], width=1.5), name="StochRSI K"), row=6, col=1) fig.add_trace(go.Scatter(x=t, y=df["StochRSI_d"],line=dict(color=COLORS["orange"], width=1.0, dash="dot"), name="StochRSI D"), row=6, col=1) for lvl in [20, 50, 80]: fig.add_hline(y=lvl, line=dict(color=COLORS["grid"], width=0.6, dash="dash"), row=6, col=1)