chore: 작업 중 발생한 부수적 변경 사항 및 누락된 파일 전체 커밋

- 프론트엔드 UI 업데이트 (backtest.html, backtest.js) 엔진 라디오 버튼 통합 관련 반영
- Rust 플러그인(kis_rust_core) 및 컴파일 소스코드 추가
- CLI 백테스트 스크립트 수정 및 최신화
- 기타 스크래치 테스트 스크립트, 로그 요약 마크다운(.md) 등 누락 파일 일괄 반영
- 추가적으로 아직 발견되지 않은 엣지 케이스나 렌더링 오류가 포함되어 있을 가능성이 있음
This commit is contained in:
Your Name
2026-09-06 17:04:50 +09:00
parent 4dbb1387a1
commit e1ac8d119b
181 changed files with 8371 additions and 503 deletions

View File

@@ -16,7 +16,7 @@ from optuna.samplers import RandomSampler, TPESampler
from database import TradeDB
from kis_trader.backtest import scalping_backtest_common as sbc
from kis_trader.backtest.breakout_tick_loader import (
load_breakout_ticks_by_code,
load_common_ticks_by_code,
tick_coverage_stats,
)
from kis_trader.backtest.optuna_search_space import scalp_grid_axis_keys, suggest_scalp_params
@@ -115,6 +115,9 @@ def prepare_scalp_search_context(
grid_axes = grids[mode]
base_fixed = _fixed_defaults()
if os.environ.get("BACKTEST_USE_RUST") == "1":
base_fixed["use_rust"] = True
if mode == "tpe":
base_fixed["skip_hts_scan_dupes"] = False
apply_session_to_fixed(base_fixed, time_start_hm=time_start_hm, time_end_hm=time_end_hm)
@@ -214,7 +217,7 @@ def prepare_scalp_search_context(
)
_tick_lbl = "ls_ws_ticks"
else:
ticks_by_code, tick_rows = load_breakout_ticks_by_code(
ticks_by_code, tick_rows = load_common_ticks_by_code(
_tick_db, start_key, end_key, set(codes_candles.keys()),
)
_tick_lbl = "ws_ticks"
@@ -299,6 +302,8 @@ def prepare_scalp_search_context(
cache_holder: Dict[str, Any] = {}
attach_indicator_caches_to_params(cache_holder, codes_candles)
if ticks_by_code and tick_backtest_meta:
cache_holder["_tick_meta_cached"] = tick_backtest_meta
# 호가·프로그램 스냅샷 (필터 ON + 그리드 스윕/재생용)
orderbook_by_code: Dict[str, Any] = {}
@@ -410,11 +415,26 @@ def run_scalp_optuna(
bind_study_trials(study, n_trials=n_trials, log=logger)
n_trials = clamp_optimize_n_trials(study, n_trials, log=logger)
import uuid
rust_session_id = f"optuna_scalp_{uuid.uuid4().hex[:8]}"
try:
import kis_rust_core
import json
candles_json = json.dumps(ctx.codes_candles)
kis_rust_core.init_backtest_session_json(
rust_session_id,
candles_json
)
except Exception as e:
logger.warning(f"Failed to init_rust_session: {e}")
def objective(trial: optuna.Trial) -> float:
if ctx.mode == "tpe":
combo = suggest_scalp_params_tpe(trial)
else:
combo = suggest_scalp_params(trial, ctx.mode)
combo["_rust_session_id"] = rust_session_id
result = evaluate_scalp_param_combo(
combo,
base_fixed=ctx.base_fixed,