refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user