refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.
This commit is contained in:
34
scratch/db_check3.py
Normal file
34
scratch/db_check3.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import sys
|
||||
sys.path.append('/home/hoon/kis_bot')
|
||||
from database import TradeDB
|
||||
|
||||
def check_db():
|
||||
db = TradeDB()
|
||||
try:
|
||||
th_cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM trade_history").fetchall()]
|
||||
print("trade_history cols:", th_cols)
|
||||
|
||||
at_cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM active_trades").fetchall()]
|
||||
print("active_trades cols:", at_cols)
|
||||
|
||||
env_cols = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM env_config").fetchall()]
|
||||
print("env_config cols:", env_cols)
|
||||
|
||||
print("--- Env Configs ---")
|
||||
query_env = "SELECT env_key, env_val FROM env_config"
|
||||
envs = db.conn.execute(query_env).fetchall()
|
||||
for e in envs:
|
||||
if "MOMENTUM" in e["env_key"] or "SCALP" in e["env_key"] or "TAIL" in e["env_key"] or "SLOT" in e["env_key"]:
|
||||
print(dict(e))
|
||||
|
||||
# Also let's just SELECT * FROM active_trades LIMIT 5
|
||||
print("--- Active Trades ---")
|
||||
ats = db.conn.execute("SELECT * FROM active_trades LIMIT 5").fetchall()
|
||||
for a in ats:
|
||||
print(dict(a))
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_db()
|
||||
Reference in New Issue
Block a user