69 lines
2.2 KiB
Python
69 lines
2.2 KiB
Python
import sys
|
|
import os
|
|
from datetime import datetime
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
|
from database import TradeDB
|
|
|
|
db = TradeDB()
|
|
try:
|
|
# 1. LS 종목 7시 수집 통계 확인
|
|
print("\n[LS Ticks]")
|
|
ls_ticks = db.conn.execute("""
|
|
SELECT HOUR(timestamp) as hr, count(*)
|
|
FROM ls_ws_ticks
|
|
WHERE date(timestamp) = '2026-08-31'
|
|
GROUP BY HOUR(timestamp)
|
|
""").fetchall()
|
|
for row in ls_ticks: print(dict(row))
|
|
|
|
print("\n[LS Orderbooks]")
|
|
ls_obs = db.conn.execute("""
|
|
SELECT HOUR(timestamp) as hr, count(*)
|
|
FROM ls_ws_orderbook
|
|
WHERE date(timestamp) = '2026-08-31'
|
|
GROUP BY HOUR(timestamp)
|
|
""").fetchall()
|
|
for row in ls_obs: print(dict(row))
|
|
|
|
print("\n[KIS Orderbooks]")
|
|
kis_obs = db.conn.execute("""
|
|
SELECT HOUR(timestamp) as hr, count(*)
|
|
FROM ws_orderbooks
|
|
WHERE date(timestamp) = '2026-08-31'
|
|
GROUP BY HOUR(timestamp)
|
|
""").fetchall()
|
|
for row in kis_obs: print(dict(row))
|
|
|
|
# 후보목록 (target_candidates)
|
|
print("\n[Target Candidates]")
|
|
# SHOW COLUMNS first as required
|
|
cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM target_candidates").fetchall()]
|
|
print("target_candidates cols:", cols)
|
|
|
|
# Check if there is target_candidates for today
|
|
tc = db.conn.execute("""
|
|
SELECT HOUR(scan_time) as hr, count(*)
|
|
FROM target_candidates
|
|
WHERE date(scan_time) = '2026-08-31'
|
|
GROUP BY HOUR(scan_time)
|
|
""").fetchall()
|
|
for row in tc: print(dict(row))
|
|
|
|
# target_candidates_ls
|
|
print("\n[Target Candidates LS]")
|
|
try:
|
|
cols_ls = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM target_candidates_ls").fetchall()]
|
|
print("target_candidates_ls cols:", cols_ls)
|
|
tc_ls = db.conn.execute("""
|
|
SELECT HOUR(scan_time) as hr, count(*)
|
|
FROM target_candidates_ls
|
|
WHERE date(scan_time) = '2026-08-31'
|
|
GROUP BY HOUR(scan_time)
|
|
""").fetchall()
|
|
for row in tc_ls: print(dict(row))
|
|
except Exception as e:
|
|
print("Error checking target_candidates_ls:", e)
|
|
|
|
finally:
|
|
db.close()
|