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

@@ -0,0 +1,18 @@
import os
import glob
import json
results_dir = "kis_trader/backtest/results"
for strat in ["BREAKOUT", "SCALP"]:
pattern = f"optuna_{strat.lower()}_fast_20*.json"
files = glob.glob(os.path.join(results_dir, pattern))
if not files: continue
latest_file = max(files, key=os.path.getmtime)
with open(latest_file, 'r', encoding='utf-8') as f:
data = json.load(f)
ws = data.get("whipsaw_recommend", {})
if ws.get("ok"):
orig = ws.get("orig_stats", {})
rec = ws.get("recommended_stats", {})
print(f"[{strat}] Original: WinRate {orig.get('win_rate')}% (count: {orig.get('count')}), PnL: {orig.get('pnl')}")
print(f"[{strat}] Recommnd: WinRate {rec.get('win_rate')}% (count: {rec.get('count')}), PnL: {rec.get('pnl')}")