Files
kis_bot/scratch_db_query.py

20 lines
667 B
Python

import sys
import os
sys.path.insert(0, os.path.abspath("."))
from kis_trader.database import TradeDBExt
db = TradeDBExt()
try:
print("--- 키움 WS 실시간 수신 상태 확인 (가장 최근 틱 조회) ---")
rows = db.conn.execute("SELECT code, price, volume, tick_time, source, recv_ts FROM ws_ticks ORDER BY recv_ts DESC LIMIT 5").fetchall()
for row in rows:
print(dict(row))
print("--- 캔들 최근 데이터 ---")
rows2 = db.conn.execute("SELECT code, close, candle_time, source, is_confirmed FROM ws_candles ORDER BY id DESC LIMIT 5").fetchall()
for row in rows2:
print(dict(row))
finally:
db.close()