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:
@@ -1814,15 +1814,14 @@ def _load_candles_for_search(
|
||||
if str(c).strip()
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
codes = list_ws_candle_codes(
|
||||
loaded = fetch_ws_candles_by_code_bulk(
|
||||
db, 1, start_key, end_key,
|
||||
market=mk if mk in ("US", "KR") else None,
|
||||
confirmed_only=True,
|
||||
)
|
||||
codes = list(loaded.keys())
|
||||
if mk == "US":
|
||||
try:
|
||||
from permanent_subs import codes_by_market as _perm_us
|
||||
@@ -1834,13 +1833,10 @@ def _load_candles_for_search(
|
||||
if want:
|
||||
codes = [c for c in codes if str(c).upper() in want]
|
||||
|
||||
min_bars = int(rsi_period) + 5
|
||||
for code in codes:
|
||||
rows = fetch_ws_candles_for_code(
|
||||
db, code, 1, start_key, end_key,
|
||||
market=mk if mk in ("US", "KR") else None,
|
||||
confirmed_only=True,
|
||||
)
|
||||
if len(rows) < rsi_period + 5:
|
||||
rows = loaded.get(code) or []
|
||||
if len(rows) < min_bars:
|
||||
continue
|
||||
codes_candles[code] = rows
|
||||
if codes_candles:
|
||||
|
||||
Reference in New Issue
Block a user