feat(vol_breakout): 15m 현물 롱 라이브·모니터·cron 운영 추가
vol_breakout 멀티종목 tick, vol_live HTML 모니터, 마감 봉만 저장하는 캔들 다운로드, 텔레그램 체결 알림, cron/watch 감시 스크립트 및 테스트를 포함한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
66
tests/test_vol_breakout_telegram.py
Normal file
66
tests/test_vol_breakout_telegram.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""vol_breakout 텔레그램 알림 포맷."""
|
||||
|
||||
from bithumb.notifications.telegram import TelegramNotifier
|
||||
|
||||
|
||||
def test_notify_vol_breakout_buy_message(monkeypatch) -> None:
|
||||
"""매수 알림이 Binance 스타일 형식인지 확인."""
|
||||
sent: list[str] = []
|
||||
|
||||
def _capture(text: str) -> bool:
|
||||
sent.append(text)
|
||||
return True
|
||||
|
||||
n = TelegramNotifier("token", "123", enabled=True)
|
||||
monkeypatch.setattr(n, "send_message", _capture)
|
||||
|
||||
n.notify_vol_breakout_trade(
|
||||
mode="live",
|
||||
symbol="TRX",
|
||||
side="buy",
|
||||
price=489.24,
|
||||
order_krw=1_187_000,
|
||||
order_coin=2.426929,
|
||||
equity_krw=500_000,
|
||||
ts="2026-06-27 19:30:05",
|
||||
)
|
||||
|
||||
assert len(sent) == 1
|
||||
text = sent[0]
|
||||
assert "[실거래] 롱 진입(매수)" in text
|
||||
assert "TRXKRW @ 489.24" in text
|
||||
assert "수량 2.426929" in text
|
||||
assert "≈1,187,000원" in text
|
||||
assert "사유 signal_vol_breakout" in text
|
||||
assert "시각 2026-06-27 19:30:05" in text
|
||||
|
||||
|
||||
def test_notify_vol_breakout_sell_message(monkeypatch) -> None:
|
||||
"""매도 알림에 손익·자본이 포함되는지 확인."""
|
||||
sent: list[str] = []
|
||||
|
||||
def _capture(text: str) -> bool:
|
||||
sent.append(text)
|
||||
return True
|
||||
|
||||
n = TelegramNotifier("token", "123", enabled=True)
|
||||
monkeypatch.setattr(n, "send_message", _capture)
|
||||
|
||||
n.notify_vol_breakout_trade(
|
||||
mode="live",
|
||||
symbol="TRX",
|
||||
side="sell",
|
||||
price=486.76,
|
||||
order_krw=1_180_000,
|
||||
order_coin=2.426929,
|
||||
equity_krw=499_691,
|
||||
pnl_krw=-7_000,
|
||||
pnl_pct=-0.590,
|
||||
ts="2026-06-27 19:45:05",
|
||||
)
|
||||
|
||||
text = sent[0]
|
||||
assert "[실거래] 롱 청산(매도)" in text
|
||||
assert "TRXKRW @ 486.76" in text
|
||||
assert "손익 -7,000원 (-0.590%)" in text
|
||||
assert "자본 499,691원" in text
|
||||
Reference in New Issue
Block a user