feat: Enhance Optuna integration and logging for backtesting framework

Changes:
- Added new API endpoints for continuing and confirming Optuna jobs, allowing for better management of ongoing studies.
- Introduced detailed logging for tick feed tracking and order book processing, improving traceability of vendor performance during backtests.
- Updated database schema to include new fields for managing Optuna study results, enhancing the ability to track study progress and outcomes.
- Refactored existing functions to utilize the new logging and tracking features, ensuring consistency across the backtesting framework.

Impact:
- These enhancements improve the robustness and transparency of the Optuna backtesting process, facilitating better analysis and optimization of trading strategies.
This commit is contained in:
Your Name
2026-08-21 19:05:23 +09:00
parent 0ecac7cb95
commit 0780b2cdd0
76 changed files with 4648 additions and 516 deletions

View File

@@ -402,24 +402,20 @@ def load_momentum_candles_by_code(
"""
market: None/빈값 = 전체(기존 동작), 'US'|'KR' = ws_candles.market 필터.
"""
from kis_trader.backtest.bt_candle_source import (
fetch_ws_candles_for_code,
list_ws_candle_codes,
)
from kis_trader.backtest.bt_candle_source import fetch_ws_candles_by_code_bulk
period_start = str(start_key)[:12]
mk = (market or "").strip().upper()
codes = list_ws_candle_codes(db, 1, start_key, end_key, market=mk or None)
ind_cols = ws_candles_select_indicator_cols(db)
loaded = fetch_ws_candles_by_code_bulk(
db, 1, start_key, end_key,
extra_select=ind_cols,
market=mk or None,
confirmed_only=False,
)
candles_by_code: Dict[str, List[Dict]] = {}
total = 0
for code in codes:
rows = fetch_ws_candles_for_code(
db, code, 1, start_key, end_key,
extra_select=ind_cols,
market=mk or None,
confirmed_only=False,
)
for code, rows in loaded.items():
if len(rows) < 6:
continue
candles_by_code[code] = rows