40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
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()
|