feat(UI/Core): DB 디버거 팝업 리스트화, Optuna 적용 연동 및 Rust tail 코어 안정화

This commit is contained in:
Your Name
2026-09-03 02:29:30 +09:00
parent 93c6f711fa
commit ac1190f1fc
13 changed files with 529 additions and 34 deletions

View File

@@ -1148,7 +1148,7 @@
<div class="row g-2 align-items-end mb-2">
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tl_use_univ_history" checked>
<input class="form-check-input" type="checkbox" id="tl_use_univ_history">
<label class="form-check-label" for="tl_use_univ_history" style="font-size:12px;color:var(--muted)">
<b>저장 후보 이력</b> — 체크: DB 슬롯·후보 / 해제: ws_candles 전 종목
</label>
@@ -1174,12 +1174,19 @@
</select>
</div>
<div class="form-check form-check-inline mt-1">
<input class="form-check-input" type="checkbox" id="tl_use_tick_db" checked>
<input class="form-check-input" type="checkbox" id="tl_use_tick_db">
<label class="form-check-label" for="tl_use_tick_db" style="font-size:12px;color:var(--muted)"
title="TAIL_BACKTEST_USE_TICK_DB — 기본 ON. limit_atr·align 진입가를 ws_ticks로 재생(실매 체결 정합)">
<b>틱 진입</b> (<code>ws_ticks</code>) — 기본 ON
</label>
</div>
<div class="form-check form-check-inline mt-1">
<input class="form-check-input" type="checkbox" id="tl_use_spill_fallback">
<label class="form-check-label" for="tl_use_spill_fallback" style="font-size:12px;color:var(--muted)"
title="TAIL_BACKTEST_USE_SPILL_FALLBACK — 기본 ON. 3사 틱 병합 시 3초 컷 지연 스필(Spill) 시뮬레이션 적용">
<b>스필 3사 폴백</b> (<code>3초컷 간택</code>) — 기본 ON
</label>
</div>
<div class="form-check form-check-inline mt-1 bt-ohlc-fallback-danger"
title="절대금지: 틱 모드에서 OHLC 폴백으로 체결·고점·PnL 변조. 엔진은 틱 청산 ON 시 이 체크를 무시함.">
<input class="form-check-input" type="checkbox" id="tl_tick_fallback_ohlc">
@@ -1391,7 +1398,7 @@
</div>
<div class="col-auto d-flex align-items-end">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="tl_eod_enabled" checked>
<input class="form-check-input" type="checkbox" id="tl_eod_enabled">
<label class="form-check-label param-row" for="tl_eod_enabled" title="ON=설정 시각 이후 보유 전량 당일청산">EOD청산</label>
</div>
</div>
@@ -1405,13 +1412,13 @@
<div class="col-12"><span class="text-muted" style="font-size:11px"><b style="color:var(--accent)">TRIGGER 필터</b> — 매수 직전 엔진 검사 (HTS tail 조건 통과 후)</span></div>
<div class="col-6 col-md-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tl_skip_hts_dupes" checked>
<input class="form-check-input" type="checkbox" id="tl_skip_hts_dupes">
<label class="form-check-label" for="tl_skip_hts_dupes" style="font-size:12px" title="3분봉 직전대비 등락(BAR_CHG) 재검사 생략 — HTS 일봉A/1분G와 축이 다름">봉등락재검스킵</label>
</div>
</div>
<div class="col-6 col-md-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tl_use_rsi_filter" checked>
<input class="form-check-input" type="checkbox" id="tl_use_rsi_filter">
<label class="form-check-label" for="tl_use_rsi_filter" style="font-size:12px">RSI필터</label>
</div>
</div>
@@ -1423,13 +1430,13 @@
</div>
<div class="col-6 col-md-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tl_use_daily_range" checked>
<input class="form-check-input" type="checkbox" id="tl_use_daily_range">
<label class="form-check-label" for="tl_use_daily_range" style="font-size:12px">당일변동필터</label>
</div>
</div>
<div class="col-6 col-md-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tl_use_high_chase_f" checked>
<input class="form-check-input" type="checkbox" id="tl_use_high_chase_f">
<label class="form-check-label" for="tl_use_high_chase_f" style="font-size:12px">고점추격필터</label>
</div>
</div>
@@ -1475,7 +1482,7 @@
<div class="col-12"><span class="text-muted" style="font-size:11px"><b style="color:var(--accent)">반전 패턴</b> — 하나라도 충족 시 진입 (env <code>TAIL_PATTERN_*</code>)</span></div>
<div class="col-6 col-md-auto">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="tl_pat_hammer" checked>
<input class="form-check-input" type="checkbox" id="tl_pat_hammer">
<label class="form-check-label" for="tl_pat_hammer" style="font-size:12px" title="TAIL_PATTERN_HAMMER">망치</label>
</div>
</div>
@@ -1516,14 +1523,42 @@
</div>
</div>
</div>
<div id="tl_ob_whip_hidden" class="d-none" aria-hidden="true">
<input type="hidden" id="tl_h_whipsaw_filter" value="">
<input type="hidden" id="tl_h_whipsaw_sub" value="">
<input type="hidden" id="tl_h_whipsaw_lb" value="">
<input type="hidden" id="tl_h_whipsaw_dip" value="">
<input type="hidden" id="tl_h_whipsaw_tol" value="">
<input type="hidden" id="tl_h_min_bid_ask_ratio" value="">
<input type="hidden" id="tl_h_ob_ask_max_mult" value="">
<!-- 호가·휩쏘 (DB 읽기전용) -->
<div class="row g-2 align-items-end mt-2 p-2 rounded" style="background:#161b22;border:1px solid #3d2a1a" id="tl_ob_whip_ro_box">
<div class="col-12">
<span class="text-muted" style="font-size:11px">
<b style="color:#f0a060">호가·휩쏘 (DB · 읽기전용)</b>
— Optuna「적용」후 여기로 확인. 백테는 이 DB값을 사용
</span>
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row">휩쏘(1=ON)</label>
<input type="text" class="form-control form-control-sm" id="tl_h_whipsaw_filter" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row">sub초</label>
<input type="text" class="form-control form-control-sm" id="tl_h_whipsaw_sub" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row">lb초</label>
<input type="text" class="form-control form-control-sm" id="tl_h_whipsaw_lb" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row">dip%</label>
<input type="text" class="form-control form-control-sm" id="tl_h_whipsaw_dip" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row">tol%</label>
<input type="text" class="form-control form-control-sm" id="tl_h_whipsaw_tol" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row" title="MIN_BID_ASK_RATIO">잔량비(ratio)</label>
<input type="text" class="form-control form-control-sm" id="tl_h_min_bid_ask_ratio" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
<div class="col-4 col-md-1">
<label class="form-label param-row" title="ENTRY_ASK_MAX_MULT">ask×(mult)</label>
<input type="text" class="form-control form-control-sm" id="tl_h_ob_ask_max_mult" readonly tabindex="-1" style="background:#0d1117;color:#f0a060">
</div>
</div>
<div class="row g-2 align-items-end mt-1">
<div class="col-12 col-md-auto mt-2 d-flex gap-2 flex-wrap align-items-center">
@@ -4099,7 +4134,7 @@
<div class="col-12">
<label class="form-label param-row mb-1">전략 <small class="text-muted">(여러 개면 순차 · 해외는 따로 체크)</small></label>
<div class="d-flex flex-wrap align-items-center gap-2" id="opt_strat_checks">
<label class="form-check form-check-inline mb-0"><input class="form-check-input opt-strat-cb" type="checkbox" value="momentum" checked> 모멘텀</label>
<label class="form-check form-check-inline mb-0"><input class="form-check-input opt-strat-cb" type="checkbox" value="momentum"> 모멘텀</label>
<label class="form-check form-check-inline mb-0" title="전역 US_MOMENTUM_* 만 · 종목 cfg는 🇺🇸탭">
<input class="form-check-input opt-strat-cb" type="checkbox" value="us_momentum"> 해외모멘텀(전역)
</label>
@@ -4128,7 +4163,7 @@
<span class="d-inline-flex flex-wrap align-items-center gap-1 px-2 py-1" style="border:1px solid var(--border);border-radius:6px" title="돌파 호가=스터디 스위치(trial 축 아님). off/on 각각 별도 스터디. 손절×호가 최대 4순차.">
<span class="text-muted" style="font-size:12px">돌파 호가</span>
<label class="form-check form-check-inline mb-0">
<input class="form-check-input opt-bo-ob" type="checkbox" id="opt_bo_ob_off" value="off" checked> off
<input class="form-check-input opt-bo-ob" type="checkbox" id="opt_bo_ob_off" value="off"> off
<small class="text-muted">필터OFF</small>
</label>
<label class="form-check form-check-inline mb-0">
@@ -4137,6 +4172,12 @@
</label>
</span>
<label class="form-check form-check-inline mb-0"><input class="form-check-input opt-strat-cb" type="checkbox" value="scalp"> 스캘핑</label>
<span class="d-inline-flex flex-wrap align-items-center gap-1 px-2 py-1" style="border:1px solid var(--border);border-radius:6px" title="TAIL_BACKTEST_USE_SPILL_FALLBACK: 백테 틱 3사(KIS,키움,LS) 3초 컷 지연 스필 시뮬레이션">
<span class="text-muted" style="font-size:12px">스필(Spill) 3사 폴백</span>
<label class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" id="opt_use_spill_fallback"> 3초 간택 (ON/OFF)
</label>
</span>
<button type="button" class="btn btn-sm btn-outline-secondary py-0" onclick="optunaPickKr4()">국내4</button>
<button type="button" class="btn btn-sm btn-outline-secondary py-0" onclick="optunaPickNone()">해제</button>
</div>
@@ -4523,6 +4564,29 @@
</div>
</div>
<!-- 🐛 DB 디버거 플로팅 패널 -->
<div id="btDbDebuggerBtn" onclick="toggleDbDebugger()" style="position:fixed; right:20px; top:70px; z-index:9999; background:var(--accent, #58a6ff); color:#fff; border-radius:50%; width:44px; height:44px; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,0.5); transition:transform 0.2s;">
<span style="font-size:20px;" title="DB 디버거 열기">🕵️</span>
</div>
<div id="btDbDebuggerPanel" style="display:none; position:fixed; right:20px; top:120px; width:360px; max-height:calc(100vh - 140px); background:#1e1e1e; border:1px solid #444; border-radius:8px; z-index:9998; box-shadow:0 8px 24px rgba(0,0,0,0.7); display:flex; flex-direction:column; overflow:hidden;">
<div style="background:#2a2a2a; padding:10px 15px; border-bottom:1px solid #444; display:flex; justify-content:space-between; align-items:center;">
<h6 style="margin:0; font-size:14px; color:#c9d1d9;">🕵️ DB 파라미터 대조 <span id="btDbDebugStrategy" style="color:var(--accent, #58a6ff); font-weight:bold; margin-left:8px;"></span></h6>
<div>
<button class="btn btn-sm btn-outline-info py-0 px-2" style="font-size:11px;" onclick="refreshDbDebugger()">새로고침</button>
<button class="btn btn-sm btn-outline-secondary py-0 px-2 ms-1" style="font-size:11px;" onclick="toggleDbDebugger()">닫기</button>
</div>
</div>
<div style="padding:10px; flex:1; overflow-y:auto;">
<p style="font-size:11px; color:#8b949e; margin-bottom:8px;">
현재 DB값과 폼 값이 다르면 <strong>붉은색</strong>으로 표시됩니다.
</p>
<div id="btDbDebuggerList" style="display:flex; flex-direction:column; gap:8px;">
<div class="text-center text-muted py-3" style="font-size:11px;">새로고침을 눌러 데이터를 불러오세요.</div>
</div>
</div>
</div>
<script src="{{ url_for('static', filename='js/backtest.js') }}?v=20260901opt_bg_pctfix"></script>
</body>
</html>