feat(옵투나·웹): 후처리 재탐색·ob_modes·적용감사·수집통계

- Optuna web jobs/TPE/apply snapshot·틱로더 정합, jobs limit·감사로그
- 백테 UI 호가모드·후보 적용 흐름, feed_collect_stats API/탭
- 가설검증·교차검증 룰, 4전략 스모크·OB slot41 진단 스크립트

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name
2026-08-27 15:23:44 +09:00
parent 5e44b86f8b
commit 8fbba264ba
30 changed files with 2973 additions and 186 deletions

View File

@@ -14,12 +14,16 @@ from typing import Any, Dict, List, Optional
import optuna
from kis_trader.backtest.optuna_tpe_common import (
ORDERBOOK_TPE_AXIS_KEYS,
RATCHET_TPE_AXIS_KEYS,
WHIPSAW_TPE_AXIS_KEYS,
r1,
r2,
r3,
r4,
suggest_orderbook_entry_tpe,
suggest_ratchet_tiers_pct,
suggest_whipsaw_tpe,
)
# 래칫: 꼬리는 소폭 % (기존 메뉴 0.3~2.0 대역) — 숫자축 + 조립 문자열
@@ -60,13 +64,14 @@ _TAIL_BASE_KEYS: List[str] = [
"pattern_morning_star",
# 당일손익 다단트레일(trail_tiers/drop/arm) — 운영 리스크 손잡이. TPE·apply 탐색 제외(DB/UI 고정).
"max_loss_krw",
"whipsaw_enabled",
"whipsaw_subbar_sec",
"whipsaw_lookback_sec",
"whipsaw_dip_pct",
"whipsaw_recovery_tol_pct",
]
TAIL_TPE_AXIS_KEYS: List[str] = list(_TAIL_BASE_KEYS) + list(RATCHET_TPE_AXIS_KEYS)
# 휩쏘 키는 WHIPSAW_TPE_AXIS_KEYS 와 동일 (아래 합침)
TAIL_TPE_AXIS_KEYS: List[str] = (
list(_TAIL_BASE_KEYS)
+ list(RATCHET_TPE_AXIS_KEYS)
+ list(ORDERBOOK_TPE_AXIS_KEYS)
+ list(WHIPSAW_TPE_AXIS_KEYS)
)
def tail_tpe_axis_keys(entry_mode: Optional[str] = None) -> List[str]:
@@ -176,22 +181,9 @@ def suggest_tail_params_tpe(
combo["max_loss_krw"] = trial.suggest_int("max_loss_krw", 50000, 300000, step=25000)
# 휩쏘 TRIGGER — 실매값(False/30/90/0.003/0.001) 포함. ON·OFF·초·% 축 분리.
combo["whipsaw_enabled"] = trial.suggest_categorical(
"whipsaw_enabled", [False, True],
)
combo["whipsaw_subbar_sec"] = trial.suggest_categorical(
"whipsaw_subbar_sec", [15, 30, 45, 60],
)
combo["whipsaw_lookback_sec"] = trial.suggest_categorical(
"whipsaw_lookback_sec", [60, 90, 120, 180],
)
combo["whipsaw_dip_pct"] = r4(
trial.suggest_float("whipsaw_dip_pct", 0.001, 0.01, step=0.001),
)
combo["whipsaw_recovery_tol_pct"] = r4(
trial.suggest_float("whipsaw_recovery_tol_pct", 0.0005, 0.003, step=0.0005),
)
# 호가 + 휩쏘 — 본 trial 엔진 경로 (휩쏘는 꼬리 필수 축)
combo.update(suggest_orderbook_entry_tpe(trial))
combo.update(suggest_whipsaw_tpe(trial, force=True))
combo["skip_hts_scan_dupes"] = False