From dfe3a2c19a9f57dded2c04100d77de6eb12973d9 Mon Sep 17 00:00:00 2001 From: ILSEON-RYU Date: Wed, 29 Apr 2026 18:00:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=95=8C=EB=A6=BC=203=EC=BA=94=EB=93=A4=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20+=20=EC=8B=9C=EA=B0=84/=EA=B0=80=EA=B2=A9?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_streamlit.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app_streamlit.py b/app_streamlit.py index e65104d..7286442 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() - last = df.iloc[-1] - for sig, key, msg in [ + recent = df.iloc[-3:] # 마지막 3개 캔들 체크 + for sig, key, msg_base 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,7 +76,12 @@ 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 last.get(sig, False) and now - _last_alert[key] > ALERT_COOLDOWN: + 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}") send_telegram(msg) _last_alert[key] = now @@ -581,8 +586,6 @@ def main(): with col4: refresh_sec = st.number_input("갱신(초)", min_value=10, max_value=300, value=30) with col5: - now_kst = datetime.now(timezone.utc) + KST - st.markdown(f"
🕐 마지막 갱신: {now_kst.strftime('%Y-%m-%d %H:%M:%S')} KST
", unsafe_allow_html=True) col5a, col5b, col5c, col5d = st.columns(4) with col5a: refresh_btn = st.button("🔄 새로고침") @@ -625,7 +628,7 @@ def main(): "modeBarButtonsToRemove": ["lasso2d", "select2d"], }) - + st.caption(f"마지막 갱신: {datetime.now().strftime('%H:%M:%S')}") except Exception as e: st.error(f"데이터 로드 오류: {e}")