feat: MDD halt 히스테리시스를 주문 가드에 연결 — 죽은 보호 경로 실동작화 - #414
Merged
Conversation
감사(2026-06-09)에서 RiskManager.check_mdd의 _is_halted(히스테리시스 복구 규칙)가 운영 코드 어디서도 소비되지 않는 죽은 경로로 확인됐다 — "복구 규칙이 보호 중"이라는 착각만 주는 상태. 제거 대신 연결(A안)을 선택한다: 아무것도 제거하지 않고, 문서화돼 있던 동작을 실제로 만들며, 기존 정적 한도 체크보다 엄격해질 뿐 느슨해질 수 없다. _drawdown_pre_order_check에서 정적 한도 체크보다 먼저 check_mdd(total_value)로 상태를 갱신(한도 돌파 시 halt 진입이 실제로 일어나도록)하고, halt 중이면 신규 BUY를 차단한다. 재개는 MDD가 한도의 절반 아래로 회복할 때(check_mdd 기존 규칙) — 한도 경계 바로 아래로 깜빡 회복했을 때 재진입→재돌파가 반복되는 것을 막는다. 특성: RiskManager 인스턴스 내 상태이므로 1회성 CLI에서는 peak이 현재값에서 시작해 정적 체크와 동일하게 동작(추가 차단 없음)하고, 상시 스케줄러(live 권장 운용)에서만 히스테리시스가 누적 동작한다. SELL/exit는 기존대로 무관(손실 축소 경로). 테스트: 돌파→halt, 한도 바로 아래 회복 시 차단 유지(mdd_hysteresis), 절반 아래 회복 시 재개 시나리오 고정. 기존 MDD 가드 테스트 전부 호환. 전체 1491 passed.
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
feat: MDD halt 히스테리시스를 주문 가드에 연결 — 죽은 보호 경로 실동작화
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경 (감사 잔여 항목의 PM 결정)
2026-06-09 감사에서
RiskManager.check_mdd의_is_halted(히스테리시스 복구 규칙)가 운영 코드 어디서도 소비되지 않는 죽은 경로로 확인됐다 — "복구 규칙이 보호 중"이라는 착각만 주는 상태였다. 선택지는 연결(A) vs 제거(B)였고, 감사의 주의는 "제거 전 운영자 확인"이었다. A(연결)를 선택한다: 아무것도 제거하지 않고, 문서화돼 있던 동작을 실제로 만들며, 기존 보호보다 엄격해질 뿐 느슨해질 수 없다.동작
_drawdown_pre_order_check에서 정적 한도 체크보다 먼저check_mdd로 상태를 갱신(돌파 시 halt 진입이 실제로 발생)하고, halt 중이면 신규 BUY 차단. 재개는 MDD가 한도의 절반 아래로 회복할 때 — 한도 경계(예: 15%) 바로 아래 14%로 깜빡 회복했을 때 재진입→재돌파가 반복되는 것을 막는다.검증
시나리오 테스트(돌파→halt / 14% 깜빡 회복 시
mdd_hysteresis차단 유지 / 7% 회복 시 재개), 기존 MDD 가드 테스트 전부 호환 — 전체 1491 passed