진입 신호 알림에 진입가/손절가 포함 + 차트 마커 표기와 일치

## 변경 사항
- 진입가를 차트 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) <noreply@anthropic.com>
This commit is contained in:
ILSEON-RYU
2026-05-01 10:29:19 +09:00
parent 43a5c52ec5
commit ffbc0da011
+22 -15
View File
@@ -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(