refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.

This commit is contained in:
Your Name
2026-08-12 10:19:19 +09:00
parent cb7e5037a0
commit c6bd62a25f
218 changed files with 31613 additions and 759 deletions

View File

@@ -3,6 +3,7 @@ kis_trader/backtest/breakout_tick_loader.py — ws_ticks 로드·분봉 인덱
"""
from __future__ import annotations
import os
from collections import defaultdict
from datetime import datetime, timedelta
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple
@@ -113,6 +114,12 @@ def _fetch_ws_ticks_day_rows(
code_filter = f" AND code IN ({placeholders})"
params.extend(sorted(codes))
tick_source = os.environ.get("TICK_SOURCE", "").strip()
source_filter = ""
if tick_source:
source_filter = " AND source = %s"
params.append(tick_source)
sql = f"""
SELECT code, tick_time, price, volume, source
FROM {table}
@@ -120,6 +127,7 @@ def _fetch_ws_ticks_day_rows(
AND tick_time >= %s
AND tick_time <= %s
{code_filter}
{source_filter}
"""
last_err: Optional[BaseException] = None
for attempt in range(1, max_retries + 1):