diff --git a/AGENTS.md b/AGENTS.md index b85d4f6..ae6aab2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,6 +80,11 @@ Highest-leverage fixes: - `TIME` and `FORCE` cooldown is based on final exit time, not entry time. - Final `TP1`/`TP2` exits block same-day re-entry for that ticker. - Re-entry control state is restored from today's DB rows after restart. +- SL cascade halt is active: + - `SL_CASCADE_HALT_THRESHOLD = 5` + - `SL_CASCADE_WINDOW_MIN = 60` + - New entries stop when the threshold is reached; existing positions keep + normal exit handling. - Duplicate bot execution guards are active: - `app/main.py` uses `SingleInstanceLock` on `logs/stockbot.lock`. - `scripts/start_bot.py` stops the PID-file process and scans for existing diff --git a/CLAUDE.md b/CLAUDE.md index 8cf1b9e..14a6852 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -80,6 +80,11 @@ Highest-leverage fixes: - `TIME` and `FORCE` cooldown is based on final exit time, not entry time. - Final `TP1`/`TP2` exits block same-day re-entry for that ticker. - Re-entry control state is restored from today's DB rows after restart. +- SL cascade halt is active: + - `SL_CASCADE_HALT_THRESHOLD = 5` + - `SL_CASCADE_WINDOW_MIN = 60` + - New entries stop when the threshold is reached; existing positions keep + normal exit handling. - Duplicate bot execution guards are active: - `app/main.py` uses `SingleInstanceLock` on `logs/stockbot.lock`. - `scripts/start_bot.py` stops the PID-file process and scans for existing diff --git a/app/config.py b/app/config.py index 7d399ba..6d02caa 100644 --- a/app/config.py +++ b/app/config.py @@ -21,6 +21,8 @@ MAX_POSITIONS = 2 ENTRY_LIMIT_ENFORCE = False MAX_DAILY_ENTRIES = 30 MAX_HOURLY_STOP_LOSS = 4 +SL_CASCADE_WINDOW_MIN = 60 +SL_CASCADE_HALT_THRESHOLD = 5 ENTRY_PAUSE_WINDOWS = ( ("11:00", "11:20"), ("14:00", "15:30"), diff --git a/app/main.py b/app/main.py index 5b786c8..b4c9de3 100644 --- a/app/main.py +++ b/app/main.py @@ -81,7 +81,8 @@ from app.config import ( MAX_UNIVERSE, FORCE_EXIT, MAX_POSITIONS, MAX_HOLD_MIN, KOSPI_MIN_CHG, MAX_DAILY_ENTRIES, MAX_HOURLY_STOP_LOSS, ENTRY_PAUSE_WINDOWS, - ENTRY_LIMIT_ENFORCE + ENTRY_LIMIT_ENFORCE, SL_CASCADE_WINDOW_MIN, + SL_CASCADE_HALT_THRESHOLD ) @@ -242,6 +243,13 @@ class StockBot: if ENTRY_LIMIT_ENFORCE and entries >= MAX_DAILY_ENTRIES: return f"daily entry limit reached {entries}/{MAX_DAILY_ENTRIES}" + cascade_stop_losses = self._recent_stop_loss_count(SL_CASCADE_WINDOW_MIN) + if cascade_stop_losses >= SL_CASCADE_HALT_THRESHOLD: + return ( + f"cascade halt: {cascade_stop_losses} stop losses in last " + f"{SL_CASCADE_WINDOW_MIN} minutes" + ) + stop_losses = self._recent_stop_loss_count(60) if ENTRY_LIMIT_ENFORCE and stop_losses >= MAX_HOURLY_STOP_LOSS: return f"{stop_losses} stop losses in last 60 minutes" diff --git a/reports/proposals/2026-06-05_strategy_proposal.md b/reports/proposals/2026-06-05_strategy_proposal.md index c068b52..e64a98e 100644 --- a/reports/proposals/2026-06-05_strategy_proposal.md +++ b/reports/proposals/2026-06-05_strategy_proposal.md @@ -1,6 +1,6 @@ # 전략 개선 제안서 — 2026-06-05 -> 상태: 수동 승인 대기 +> 상태: 적용 완료 (2026-06-06 사용자 승인) > 근거: 12거래일 / 168회 거래 > 증거 충분도: **부족 (30거래일 미만)** — 참고용, 적용 전 신중 검토 필요 @@ -69,9 +69,9 @@ if recent_sl_count >= CONSEC_SL_HALT_THRESHOLD: ### 예상 효과 -오늘 기준: threshold=5 적용 시 09:34 이후 신규 진입 중단 가능 -→ 차단 가능 손실: SK증권(-6,312) + 아리바이오랩(-6,303) + 디앤디파마텍(-5,947) + 이후 4건 -→ **약 +30,000~40,000원 손실 감소** (아주IB투자 TP1 기회 차단은 감수) +오늘 기준: threshold=5 적용 시 09:36 이후 신규 진입 중단 가능 +→ 차단 가능 손실: 아리바이오랩(-6,303) + 디앤디파마텍(-5,947) + 이후 5건 +→ **약 +20,000원 손실 감소** (아주IB투자/코스모로보틱스 수익 기회 차단 포함) ### 리스크