refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.
This commit is contained in:
26
scratch/check_db_stats2.py
Normal file
26
scratch/check_db_stats2.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, '/home/hoon/kis_bot')
|
||||
from database import TradeDB
|
||||
|
||||
db = TradeDB()
|
||||
today = "2026-08-11"
|
||||
|
||||
queries = {
|
||||
"trade_history": f"SELECT COUNT(*) FROM trade_history WHERE buy_date >= '{today} 00:00:00'",
|
||||
"kis_ws_orderbook": f"SELECT COUNT(*) FROM kis_ws_orderbook WHERE recv_ts >= '{today} 00:00:00'",
|
||||
"ls_ws_orderbook": f"SELECT COUNT(*) FROM ls_ws_orderbook WHERE recv_ts >= '{today} 00:00:00'",
|
||||
"ws_orderbook": f"SELECT COUNT(*) FROM ws_orderbook WHERE recv_ts >= '{today} 00:00:00'",
|
||||
"ls_ws_ticks": f"SELECT COUNT(*) FROM ls_ws_ticks WHERE ts >= '{today} 00:00:00'",
|
||||
"ws_ticks": f"SELECT COUNT(*) FROM ws_ticks WHERE recv_ts >= '{today} 00:00:00'",
|
||||
"ls_ws_candles": f"SELECT COUNT(*) FROM ls_ws_candles WHERE datetime >= '{today} 00:00:00'",
|
||||
"ws_candles": f"SELECT COUNT(*) FROM ws_candles WHERE candle_time >= '{today} 00:00:00'",
|
||||
}
|
||||
|
||||
for name, q in queries.items():
|
||||
try:
|
||||
res = db.conn.execute(q).fetchone()
|
||||
print(f"COUNT {name}: {res[0]}")
|
||||
except Exception as e:
|
||||
print(f"ERROR {name}: {e}")
|
||||
db.close()
|
||||
Reference in New Issue
Block a user