feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료
This commit is contained in:
55
scratch/check_chetime.py
Normal file
55
scratch/check_chetime.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
ls_ws_ticks.chetime 실제 값 샘플 확인
|
||||
→ REGEXP_REPLACE 없이 처리 가능한지 패턴 파악
|
||||
"""
|
||||
import sys, os
|
||||
sys.path.insert(0, '/home/hoon/kis_bot')
|
||||
os.chdir('/home/hoon/kis_bot')
|
||||
|
||||
from database import TradeDB
|
||||
db = TradeDB()
|
||||
|
||||
try:
|
||||
# chetime 샘플 (다양한 패턴 확인)
|
||||
rows = db.conn.execute(
|
||||
"SELECT chetime, ts FROM ls_ws_ticks "
|
||||
"WHERE ts >= '2026-09-02 09:00:00' AND ts <= '2026-09-02 15:40:00' "
|
||||
"ORDER BY ts LIMIT 20"
|
||||
).fetchall()
|
||||
print("=== chetime 샘플 ===")
|
||||
for r in rows:
|
||||
d = dict(r)
|
||||
print(f" chetime={repr(d['chetime'])!r:30s} ts={d['ts']}")
|
||||
|
||||
# chetime NULL 비율
|
||||
r = db.conn.execute(
|
||||
"SELECT "
|
||||
" COUNT(*) AS total, "
|
||||
" SUM(CASE WHEN chetime IS NULL OR chetime='' THEN 1 ELSE 0 END) AS null_cnt, "
|
||||
" SUM(CASE WHEN CHAR_LENGTH(chetime) >= 6 THEN 1 ELSE 0 END) AS has6, "
|
||||
" SUM(CASE WHEN CHAR_LENGTH(chetime) >= 14 THEN 1 ELSE 0 END) AS has14, "
|
||||
" SUM(CASE WHEN chetime REGEXP '[^0-9]' THEN 1 ELSE 0 END) AS has_nonnumeric "
|
||||
"FROM ls_ws_ticks "
|
||||
"WHERE ts >= '2026-09-02 09:00:00' AND ts <= '2026-09-02 15:40:00'"
|
||||
).fetchone()
|
||||
d = dict(r)
|
||||
print(f"\n=== chetime 통계 (당일) ===")
|
||||
print(f" 총행: {d['total']}")
|
||||
print(f" NULL/빈값: {d['null_cnt']}")
|
||||
print(f" 6자리 이상: {d['has6']}")
|
||||
print(f" 14자리 이상: {d['has14']}")
|
||||
print(f" 비숫자 포함: {d['has_nonnumeric']}")
|
||||
|
||||
# 비숫자 포함 샘플
|
||||
if d['has_nonnumeric']:
|
||||
rows2 = db.conn.execute(
|
||||
"SELECT chetime FROM ls_ws_ticks "
|
||||
"WHERE ts >= '2026-09-02 09:00:00' AND ts <= '2026-09-02 15:40:00' "
|
||||
"AND chetime REGEXP '[^0-9]' LIMIT 5"
|
||||
).fetchall()
|
||||
print(f"\n 비숫자 포함 샘플:")
|
||||
for r in rows2:
|
||||
print(f" {repr(dict(r)['chetime'])}")
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user