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

@@ -263,10 +263,35 @@ def _patch_from_momentum_merged(m: Dict[str, Any]) -> Dict[str, str]:
from kis_trader.engine.orderbook_env import orderbook_params_to_env_patch
patch.update(orderbook_params_to_env_patch("MOMENTUM", m))
patch.update(_whipsaw_combo_to_env_patch("MOMENTUM", m))
return patch
def _whipsaw_combo_to_env_patch(strategy: str, m: Dict[str, Any]) -> Dict[str, str]:
"""TPE/Grid merged 의 whipsaw_* → {STRAT}_WHIPSAW_* (돌파·꼬리 스킵은 호출측)."""
if "whipsaw_enabled" not in m and "whipsaw_subbar_sec" not in m:
return {}
from kis_trader.backtest.optuna_whipsaw_recommend import _whipsaw_env_prefix
pfx = _whipsaw_env_prefix(strategy)
if not pfx:
return {}
out: Dict[str, str] = {}
if "whipsaw_enabled" in m and m.get("whipsaw_enabled") is not None:
on = str(m.get("whipsaw_enabled")).strip().lower() in ("1", "true", "yes", "on")
out[f"{pfx}_WHIPSAW_FILTER_ENABLED"] = "true" if on else "false"
if m.get("whipsaw_subbar_sec") not in (None, ""):
out[f"{pfx}_WHIPSAW_SUBBAR_SEC"] = str(int(float(m["whipsaw_subbar_sec"])))
if m.get("whipsaw_lookback_sec") not in (None, ""):
out[f"{pfx}_WHIPSAW_LOOKBACK_SEC"] = str(int(float(m["whipsaw_lookback_sec"])))
if m.get("whipsaw_dip_pct") not in (None, ""):
out[f"{pfx}_WHIPSAW_DIP_PCT"] = str(float(m["whipsaw_dip_pct"]))
if m.get("whipsaw_recovery_tol_pct") not in (None, ""):
out[f"{pfx}_WHIPSAW_RECOVERY_TOL_PCT"] = str(float(m["whipsaw_recovery_tol_pct"]))
return out
def apply_env_patch(patch: Dict[str, str]) -> Optional[int]:
"""병합 스냅샷에 patch 반영 후 insert_env_snapshot — config_scalp/momentum/… 분리 저장."""
if not patch:
@@ -422,6 +447,7 @@ def _patch_from_breakout_merged(m: Dict[str, Any]) -> Dict[str, str]:
from kis_trader.engine.orderbook_env import orderbook_params_to_env_patch
patch.update(orderbook_params_to_env_patch("BREAKOUT", m))
# 돌파 휩쏘는 DB 적용 스킵(기존) — TPE에도 휩쏘 축 없음
return patch