feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료
This commit is contained in:
37
scratch/check_kis_ob.py
Normal file
37
scratch/check_kis_ob.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
||||
from database import TradeDB
|
||||
|
||||
db = TradeDB()
|
||||
try:
|
||||
print("[KIS WS Orderbook Cols]")
|
||||
cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM kis_ws_orderbook").fetchall()]
|
||||
print(cols)
|
||||
|
||||
ts_col = 'snap_time' if 'snap_time' in cols else ('ts' if 'ts' in cols else 'timestamp')
|
||||
|
||||
recent = db.conn.execute(f"""
|
||||
SELECT * FROM kis_ws_orderbook
|
||||
WHERE date({ts_col}) = '2026-08-31'
|
||||
ORDER BY {ts_col} DESC LIMIT 5
|
||||
""").fetchall()
|
||||
|
||||
print("\n[Recent KIS WS Orderbook]")
|
||||
for row in recent:
|
||||
d = dict(row)
|
||||
if 'levels_json' in d and d['levels_json']:
|
||||
d['levels_json'] = d['levels_json'][:50] + "..."
|
||||
print(d)
|
||||
|
||||
counts = db.conn.execute(f"""
|
||||
SELECT HOUR({ts_col}) as hr, count(*)
|
||||
FROM kis_ws_orderbook
|
||||
WHERE date({ts_col}) = '2026-08-31'
|
||||
GROUP BY HOUR({ts_col})
|
||||
""").fetchall()
|
||||
print("\n[KIS WS Orderbook Counts]")
|
||||
for row in counts: print(dict(row))
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user