refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.
This commit is contained in:
39
scratch/check_tick_normalize2.py
Normal file
39
scratch/check_tick_normalize2.py
Normal 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()
|
||||
Reference in New Issue
Block a user