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,39 @@
import sys
sys.path.insert(0, '.')
from database import TradeDB
db = TradeDB()
try:
# 07일 날짜로 시간대별 확인 - tick_time 형식: 20260807HHMMSS
rows = db.conn.execute(
"""
SELECT
SUBSTR(tick_time, 9, 2) as hh,
source,
COUNT(*) as cnt
FROM ws_ticks
WHERE market='KR' AND tick_time >= '20260807090000' AND tick_time <= '20260807160000'
GROUP BY SUBSTR(tick_time, 9, 2), source
ORDER BY hh ASC, source ASC
""",
).fetchall()
print("[20260807 장중 시간대별 틱 건수]")
for r in rows:
print(f" {dict(r)['hh']}시 | {dict(r).get('source','?'):6s} | {dict(r)['cnt']:,}")
# 어제 어디서 데이터가 얼마나 있는지 전체
total_rows = db.conn.execute(
"""
SELECT source, COUNT(*) as cnt
FROM ws_ticks
WHERE market='KR' AND tick_time >= '20260807090000' AND tick_time <= '20260807160000'
GROUP BY source
""",
).fetchall()
print("\n[전체 소스별]")
for r in total_rows:
print(f" {dict(r).get('source','?'):6s}: {dict(r)['cnt']:,}")
finally:
db.close()