feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료
This commit is contained in:
49
scratch/check_after_restart2.py
Normal file
49
scratch/check_after_restart2.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import sys, os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
||||
from database import TradeDB
|
||||
|
||||
db = TradeDB()
|
||||
try:
|
||||
# ls_ws_ticks 컬럼 확인
|
||||
ls_tick_cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM ls_ws_ticks").fetchall()]
|
||||
print("[ls_ws_ticks 컬럼]:", ls_tick_cols)
|
||||
ts_col = next((c for c in ['recv_ts','ts','timestamp','snap_time','created_at'] if c in ls_tick_cols), None)
|
||||
|
||||
if ts_col:
|
||||
print(f"\n[LS 틱 시간대별 - {ts_col} 기준]")
|
||||
ls_hourly = db.conn.execute(f"""
|
||||
SELECT HOUR({ts_col}) as hr, count(*) as c
|
||||
FROM ls_ws_ticks
|
||||
WHERE DATE({ts_col}) = '2026-08-31'
|
||||
GROUP BY hr ORDER BY hr
|
||||
""").fetchall()
|
||||
for r in ls_hourly:
|
||||
print(f" {dict(r)}")
|
||||
|
||||
new_ticks = db.conn.execute(f"""
|
||||
SELECT count(*) as c FROM ls_ws_ticks
|
||||
WHERE {ts_col} >= '2026-08-31 12:22:00'
|
||||
""").fetchone()
|
||||
print(f"\n 재시작(12:22) 이후 틱: {dict(new_ticks)['c']}")
|
||||
|
||||
latest = db.conn.execute(f"SELECT MAX({ts_col}) as last FROM ls_ws_ticks").fetchone()
|
||||
print(f" 가장 최근 틱: {dict(latest)['last']}")
|
||||
|
||||
# 후보 목록
|
||||
print("\n[target_candidates]")
|
||||
cands = db.conn.execute("SELECT count(*) as c FROM target_candidates").fetchone()
|
||||
print(f" 총 {dict(cands)['c']}건")
|
||||
|
||||
# ls_universe_history
|
||||
print("\n[ls_universe_history]")
|
||||
uh_cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM ls_universe_history").fetchall()]
|
||||
ts2 = next((c for c in ['created_at','updated_at','scan_time','ts'] if c in uh_cols), None)
|
||||
if ts2:
|
||||
cnt_today = db.conn.execute(f"SELECT count(*) as c FROM ls_universe_history WHERE DATE({ts2}) = '2026-08-31'").fetchone()
|
||||
print(f" 오늘({ts2}): {dict(cnt_today)['c']}건")
|
||||
latest2 = db.conn.execute(f"SELECT MAX({ts2}) as last FROM ls_universe_history").fetchone()
|
||||
print(f" 전체 최근: {dict(latest2)['last']}")
|
||||
else:
|
||||
print(" ts컬럼 없음, 컬럼:", uh_cols)
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user