From ffbc0da01109a2251f26abdb43d6122adbb282b0 Mon Sep 17 00:00:00 2001 From: ILSEON-RYU Date: Fri, 1 May 2026 10:29:19 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=84=EC=9E=85=20=EC=8B=A0=ED=98=B8=20?= =?UTF-8?q?=EC=95=8C=EB=A6=BC=EC=97=90=20=EC=A7=84=EC=9E=85=EA=B0=80/?= =?UTF-8?q?=EC=86=90=EC=A0=88=EA=B0=80=20=ED=8F=AC=ED=95=A8=20+=20?= =?UTF-8?q?=EC=B0=A8=ED=8A=B8=20=EB=A7=88=EC=BB=A4=20=ED=91=9C=EA=B8=B0?= =?UTF-8?q?=EC=99=80=20=EC=9D=BC=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 변경 사항 - 진입가를 차트 hover 마커가 보여주는 값과 동일하게 통일. - 롱: low * 0.9998 - 숏: high * 1.0002 - 손절가는 진입가 * (1 ± STOP_LOSS_PCT) 로 계산되므로 reference 가격이 10bps 차이나도 손절가 비율은 정확히 ±10% 로 유지됨. - 텔레그램 진입 신호 메시지에 진입가/손절가 두 줄 추가. ## 메시지 예시 🔼 롱 진입 신호 BTCUSDT 5m 진입가: 76245.84 손절가: 68621.26 🛑 롱 손절가 도달 (-10%) BTCUSDT 5m 진입가: 76245.84 손절가: 68621.26 현재가: 68500.00 ## 영향 없는 시그널 short_caution_signal 은 진입 신호가 아니므로 가격 정보 없이 기존 형식 유지. Co-Authored-By: Claude Opus 4.7 (1M context) --- app_streamlit.py | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/app_streamlit.py b/app_streamlit.py index 0fb8985..88b1480 100644 --- a/app_streamlit.py +++ b/app_streamlit.py @@ -75,14 +75,14 @@ def check_and_alert(df, symbol, interval): global _long_entry, _short_entry now = time.time() recent = df.tail(3) - 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}"), - ("short_signal", "short", f"🔽 숏 진입 신호\n{symbol} {interval}"), - ("vol_long_signal", "vol_long", f"🔼 볼륨급등 롱 신호\n{symbol} {interval}"), - ("vol_short_signal", "vol_short", f"🔽 볼륨급등 숏 신호\n{symbol} {interval}"), - ("short_caution_signal","short_caution",f"⚠️ 숏 진입 주의 신호\n{symbol} {interval}"), + for sig, key, label in [ + ("strong_long_signal", "strong_long", "🟢 강한 롱 진입 신호"), + ("strong_short_signal", "strong_short", "🔴 강한 숏 진입 신호"), + ("long_signal", "long", "🔼 롱 진입 신호"), + ("short_signal", "short", "🔽 숏 진입 신호"), + ("vol_long_signal", "vol_long", "🔼 볼륨급등 롱 신호"), + ("vol_short_signal", "vol_short", "🔽 볼륨급등 숏 신호"), + ("short_caution_signal","short_caution","⚠️ 숏 진입 주의 신호"), ]: if sig not in recent.columns: continue @@ -94,17 +94,24 @@ def check_and_alert(df, symbol, interval): continue if now - _last_alert[key] <= ALERT_COOLDOWN: continue + + if sig in LONG_SIGNALS: + entry_price = float(triggered.iloc[-1]["low"]) * 0.9998 + stop_price = entry_price * (1 - STOP_LOSS_PCT) + msg = f"{label}\n{symbol} {interval}\n진입가: {entry_price:.2f}\n손절가: {stop_price:.2f}" + _long_entry = {"price": entry_price, "stop": stop_price, "open_time": candle_time} + elif sig in SHORT_SIGNALS: + entry_price = float(triggered.iloc[-1]["high"]) * 1.0002 + stop_price = entry_price * (1 + STOP_LOSS_PCT) + msg = f"{label}\n{symbol} {interval}\n진입가: {entry_price:.2f}\n손절가: {stop_price:.2f}" + _short_entry = {"price": entry_price, "stop": stop_price, "open_time": candle_time} + else: + msg = f"{label}\n{symbol} {interval}" + send_telegram(msg) _last_alert[key] = now _last_fired_candle[key] = candle_time - if sig in LONG_SIGNALS: - entry_price = float(triggered.iloc[-1]["close"]) - _long_entry = {"price": entry_price, "stop": entry_price * (1 - STOP_LOSS_PCT), "open_time": candle_time} - elif sig in SHORT_SIGNALS: - entry_price = float(triggered.iloc[-1]["close"]) - _short_entry = {"price": entry_price, "stop": entry_price * (1 + STOP_LOSS_PCT), "open_time": candle_time} - current_price = float(df.iloc[-1]["close"]) if _long_entry is not None and current_price <= _long_entry["stop"]: send_telegram(