feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료
This commit is contained in:
60
scratch/deep_dive.py
Normal file
60
scratch/deep_dive.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
||||
from database import TradeDB
|
||||
import json
|
||||
|
||||
db = TradeDB()
|
||||
try:
|
||||
print("[Target Candidates History by Market]")
|
||||
tc_market = db.conn.execute("""
|
||||
SELECT market, count(*) as c
|
||||
FROM target_candidates_history
|
||||
WHERE date(scan_time) = '2026-08-31'
|
||||
GROUP BY market
|
||||
""").fetchall()
|
||||
for row in tc_market: print(dict(row))
|
||||
|
||||
print("\n[LS Candidates History Cols]")
|
||||
cols_lch = [dict(r)["Field"] for r in db.conn.execute("SHOW COLUMNS FROM ls_candidates_history").fetchall()]
|
||||
print(cols_lch)
|
||||
|
||||
if len(cols_lch) > 0:
|
||||
date_col_lch = 'scan_time' if 'scan_time' in cols_lch else ('created_at' if 'created_at' in cols_lch else 'ts')
|
||||
lch_data = db.conn.execute(f"""
|
||||
SELECT HOUR({date_col_lch}) as hr, count(*)
|
||||
FROM ls_candidates_history
|
||||
WHERE date({date_col_lch}) = '2026-08-31'
|
||||
GROUP BY HOUR({date_col_lch})
|
||||
""").fetchall()
|
||||
print("LS Candidates History by hour:")
|
||||
for row in lch_data: print(dict(row))
|
||||
|
||||
print("\n[WS Orderbook (KIS) Recent]")
|
||||
recent_ob = db.conn.execute("""
|
||||
SELECT *
|
||||
FROM ws_orderbook
|
||||
WHERE date(snap_time) = '2026-08-31'
|
||||
ORDER BY snap_time DESC
|
||||
LIMIT 5
|
||||
""").fetchall()
|
||||
for r in recent_ob:
|
||||
d = dict(r)
|
||||
d['levels_json'] = d['levels_json'][:50] + "..." if d['levels_json'] else None
|
||||
print(d)
|
||||
|
||||
print("\n[LS WS Orderbook Recent]")
|
||||
ls_recent_ob = db.conn.execute("""
|
||||
SELECT *
|
||||
FROM ls_ws_orderbook
|
||||
WHERE date(snap_time) = '2026-08-31'
|
||||
ORDER BY snap_time DESC
|
||||
LIMIT 5
|
||||
""").fetchall()
|
||||
for r in ls_recent_ob:
|
||||
d = dict(r)
|
||||
d['levels_json'] = d['levels_json'][:50] + "..." if d['levels_json'] else None
|
||||
print(d)
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user