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

@@ -17,6 +17,7 @@ from kis_trader.backtest.backtest_portfolio_common import (
merge_portfolio_into_params,
min_invest_ratio_of_slot,
resolve_portfolio_params,
resolve_trigger_snapshots_for_backtest,
summarize_trades,
)
from kis_trader.backtest.breakout_tick_loader import (
@@ -308,6 +309,22 @@ def run_scalping_backtest_web_aligned(
len(lst) for cm in loaded_ticks.values() for lst in cm.values()
)
# 진입·프로그램 호가 스냅 — 모멘텀/돌파/꼬리 web_aligned 와 동일.
# 미로드 시 호가필터 ON + REJECT_IF_EMPTY → 전부「호가없음」0건.
# Optuna/그리드가 이미 _bt_orderbook_by_code 를 넣었으면 재사용(비었을 때만 DB).
ob_loaded, pg_loaded, snap_meta = resolve_trigger_snapshots_for_backtest(
candles_by_code,
engine_params,
strategy=SCALP_STRATEGY_ID,
meta_out=meta_out,
orderbook_by_code=engine_params.get("_bt_orderbook_by_code"),
program_by_code=engine_params.get("_bt_program_by_code"),
)
if ob_loaded is not None:
engine_params["_bt_orderbook_by_code"] = ob_loaded
if pg_loaded is not None:
engine_params["_bt_program_by_code"] = pg_loaded
trades = se.run_scalping_backtest(
candles_by_code, engine_params, universe_by_slot=universe_by_slot,
ticks_by_code=loaded_ticks or None,
@@ -327,6 +344,8 @@ def run_scalping_backtest_web_aligned(
if meta_out is not None:
meta_out["universe_exit_debounce_sec"] = scalp_universe_exit_debounce_sec()
meta_out["candle_warmup_bars"] = scalp_backtest_candle_warmup_bars()
if snap_meta:
meta_out["trigger_snapshot_backtest"] = snap_meta
attach_scalp_trade_pnl(
trades, fee_rate=fee_rate, sell_tax=sell_tax,