refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities.
This commit is contained in:
34
scratch/check_db_stats_table.py
Normal file
34
scratch/check_db_stats_table.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import sys
|
||||
sys.path.insert(0, '/home/hoon/kis_bot')
|
||||
from database import TradeDB
|
||||
|
||||
db = TradeDB()
|
||||
tables = [
|
||||
'trade_history',
|
||||
'ws_ticks', 'ws_candles', 'ws_orderbook', 'kis_ws_orderbook',
|
||||
'ls_ws_ticks', 'ls_ws_candles', 'ls_ws_orderbook'
|
||||
]
|
||||
|
||||
print("| 증권사 | 데이터 유형 | 테이블명 | 현재 적재 건수 |")
|
||||
print("|---|---|---|---|")
|
||||
|
||||
for t in tables:
|
||||
try:
|
||||
count = db.conn.execute(f"SELECT COUNT(*) FROM {t}").fetchone()[0]
|
||||
|
||||
broker = "공통"
|
||||
if "ls_" in t:
|
||||
broker = "LS증권"
|
||||
elif "kis_" in t or t in ['ws_ticks', 'ws_candles', 'ws_orderbook']:
|
||||
broker = "한국투자증권(KIS) / 키움"
|
||||
|
||||
data_type = "매매내역"
|
||||
if "tick" in t: data_type = "실시간 체결 틱"
|
||||
elif "candle" in t: data_type = "실시간 캔들 (분봉)"
|
||||
elif "orderbook" in t: data_type = "호가 스냅샷 (Orderbook)"
|
||||
|
||||
print(f"| {broker} | {data_type} | `{t}` | {count:,} 건 |")
|
||||
except Exception as e:
|
||||
print(f"| - | - | `{t}` | 에러: {e} |")
|
||||
|
||||
db.close()
|
||||
Reference in New Issue
Block a user