feat(UI/Core): DB 디버거 팝업 리스트화, Optuna 적용 연동 및 Rust tail 코어 안정화
This commit is contained in:
@@ -209,6 +209,7 @@ def load_breakout_ticks_by_code(
|
||||
codes: Optional[Set[str]] = None,
|
||||
*,
|
||||
market: Optional[str] = None,
|
||||
use_spill_fallback: bool = True,
|
||||
) -> Tuple[Dict[str, Dict[str, List[Dict[str, Any]]]], int]:
|
||||
"""
|
||||
기간 내 체결 틱을 종목·분봉(YYYYMMDDHHMM) 단위로 로드.
|
||||
@@ -322,9 +323,15 @@ def load_breakout_ticks_by_code(
|
||||
for _mk, ticks in list(minutes.items()):
|
||||
ticks.sort(key=lambda t: str(t.get("tick_time") or ""))
|
||||
if mkt != "US":
|
||||
filtered = merge_ticks_time_axis_fallback(ticks, main_src=main_src)
|
||||
minutes[_mk] = filtered
|
||||
kept += len(filtered)
|
||||
if use_spill_fallback:
|
||||
filtered = merge_ticks_time_axis_fallback(ticks, main_src=main_src)
|
||||
minutes[_mk] = filtered
|
||||
kept += len(filtered)
|
||||
else:
|
||||
# 스필 OFF: 메인 소스만 필터 없이 그냥 사용
|
||||
filtered = [t for t in ticks if str(t.get("source") or "").strip().lower() == main_src]
|
||||
minutes[_mk] = filtered if filtered else ticks # 메인이 없으면 보조라도 그대로 둠
|
||||
kept += len(minutes[_mk])
|
||||
else:
|
||||
kept += len(ticks)
|
||||
if kept != total:
|
||||
@@ -335,8 +342,8 @@ def load_breakout_ticks_by_code(
|
||||
raw_before_merge = total
|
||||
total = kept
|
||||
|
||||
# 실매 3차 LS: 같은 초에 1·2차 없으면 ls_ws_ticks (나이=LIVE_FEED_FALLBACK, 기본 3초)
|
||||
if mkt != "US" and get_env_bool("BT_TICK_LS_THIRD_FALLBACK", True):
|
||||
# 실매 3차 LS: 스필 ON이고 같은 초에 1·2차 없으면 ls_ws_ticks
|
||||
if use_spill_fallback and mkt != "US" and get_env_bool("BT_TICK_LS_THIRD_FALLBACK", True):
|
||||
try:
|
||||
from kis_trader.backtest.ls_history_loaders import load_ls_ticks_by_code
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ def run_tail_backtest_web_aligned(
|
||||
meta_out: Optional[Dict[str, Any]] = None,
|
||||
) -> List[Dict]:
|
||||
"""엔진 1회 + 웹과 동일 손익 부착 (ws_ticks 리플레이 옵션)."""
|
||||
from kis_trader.engine.tail_tick_replay import tail_backtest_wants_tick_replay
|
||||
from kis_trader.engine.tail_tick_replay import tail_backtest_wants_tick_replay, tail_backtest_use_spill_fallback
|
||||
from kis_trader.backtest.tail_tick_loader import load_tail_ticks_by_code, tick_coverage_stats
|
||||
|
||||
engine_params = dict(params)
|
||||
@@ -761,6 +761,7 @@ def run_tail_backtest_web_aligned(
|
||||
if db and start_key and end_key:
|
||||
loaded_ticks, tick_rows = load_tail_ticks_by_code(
|
||||
db, start_key, end_key, set(candles_by_code.keys()),
|
||||
use_spill_fallback=tail_backtest_use_spill_fallback(engine_params),
|
||||
)
|
||||
tick_meta = tick_coverage_stats(candles_by_code, loaded_ticks)
|
||||
tick_meta["ws_tick_rows_loaded"] = tick_rows
|
||||
|
||||
Reference in New Issue
Block a user