Files
kis_trader/scratch/find_optuna_trial.py
Your Name e1ac8d119b chore: 작업 중 발생한 부수적 변경 사항 및 누락된 파일 전체 커밋
- 프론트엔드 UI 업데이트 (backtest.html, backtest.js) 엔진 라디오 버튼 통합 관련 반영
- Rust 플러그인(kis_rust_core) 및 컴파일 소스코드 추가
- CLI 백테스트 스크립트 수정 및 최신화
- 기타 스크래치 테스트 스크립트, 로그 요약 마크다운(.md) 등 누락 파일 일괄 반영
- 추가적으로 아직 발견되지 않은 엣지 케이스나 렌더링 오류가 포함되어 있을 가능성이 있음
2026-09-06 17:04:50 +09:00

30 lines
1.4 KiB
Python

import json
import glob
import sys
files = sorted(glob.glob('/home/hoon/kis_bot/logs/optuna_web_jobs/import_optuna_scalp_*.json'), reverse=True)[:5]
files += sorted(glob.glob('/home/hoon/kis_bot/kis_trader/backtest/results/optuna_scalp_tpe_*.json'), reverse=True)[:5]
for fpath in files:
try:
with open(fpath) as f:
data = json.load(f)
# import 된 잡 (웹 UI 용) 일 경우:
trials = data.get('trials', []) or data.get('optuna_trials', [])
for tr in trials:
# optuna_web_jobs/ 에 있는 json의 경우 tr 구조가 다름. (t, p, s, attrs)
if 't' in tr: # trial number is 't'
if tr.get('t') == 198 or tr.get('attrs', {}).get('trades') == 361:
print(f"Found in {fpath}: Trial {tr.get('t')} with {tr.get('attrs', {}).get('trades')} trades")
print(json.dumps(tr.get('p', {}), indent=2, ensure_ascii=False))
sys.exit(0)
elif 'number' in tr:
if tr.get('number') == 198 or tr.get('user_attrs', {}).get('trades') == 361:
print(f"Found in {fpath}: Trial {tr.get('number')} with {tr.get('user_attrs', {}).get('trades')} trades")
print(json.dumps(tr.get('params', {}), indent=2, ensure_ascii=False))
sys.exit(0)
except Exception as e:
pass
print("Not found")