36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
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:
|
|
res = db.conn.execute(f"SELECT COUNT(*) as c FROM {t}").fetchone()
|
|
count = dict(res)['c']
|
|
|
|
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()
|