feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료
This commit is contained in:
51
scratch/check_db_proper.py
Normal file
51
scratch/check_db_proper.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
||||
from database import TradeDB
|
||||
|
||||
db = TradeDB()
|
||||
try:
|
||||
print("[LS Universe History Cols]")
|
||||
cols_lu = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM ls_universe_history").fetchall()]
|
||||
print(cols_lu)
|
||||
|
||||
date_col_lu = 'scan_time' if 'scan_time' in cols_lu else ('created_at' if 'created_at' in cols_lu else 'ts')
|
||||
lu_data = db.conn.execute(f"SELECT * FROM ls_universe_history WHERE date({date_col_lu}) = '2026-08-31'").fetchall()
|
||||
print(f"LS Universe count for today: {len(lu_data)}")
|
||||
if len(lu_data) > 0:
|
||||
print("Sample:", dict(lu_data[-1]))
|
||||
|
||||
print("\n[Target Candidates History Cols]")
|
||||
cols_tc = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM target_candidates_history").fetchall()]
|
||||
print(cols_tc)
|
||||
|
||||
date_col_tc = 'scan_time' if 'scan_time' in cols_tc else ('created_at' if 'created_at' in cols_tc else 'ts')
|
||||
tc_data = db.conn.execute(f"SELECT * FROM target_candidates_history WHERE date({date_col_tc}) = '2026-08-31'").fetchall()
|
||||
print(f"Target Candidates count for today: {len(tc_data)}")
|
||||
|
||||
print("\n[WS Orderbook Cols]")
|
||||
cols_ob = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM ws_orderbook").fetchall()]
|
||||
print(cols_ob)
|
||||
|
||||
ts_col = 'ts' if 'ts' in cols_ob else ('timestamp' if 'timestamp' in cols_ob else 'snap_time')
|
||||
|
||||
zeros = db.conn.execute(f"""
|
||||
SELECT count(*) as c
|
||||
FROM ws_orderbook
|
||||
WHERE date({ts_col}) = '2026-08-31'
|
||||
AND (total_bid_qty = 0 OR total_ask_qty = 0 OR best_bid = 0 OR best_ask = 0)
|
||||
""").fetchone()
|
||||
print("Zeros count in KIS orderbook:", dict(zeros))
|
||||
|
||||
sample_zero = db.conn.execute(f"""
|
||||
SELECT *
|
||||
FROM ws_orderbook
|
||||
WHERE date({ts_col}) = '2026-08-31'
|
||||
AND (total_bid_qty = 0 OR total_ask_qty = 0 OR best_bid = 0 OR best_ask = 0)
|
||||
LIMIT 1
|
||||
""").fetchone()
|
||||
if sample_zero:
|
||||
print("Sample Zero:", dict(sample_zero))
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user