feat(Core/UI): 백테스트 전역 엔진 선택 버튼 추가 및 스캘핑 Rust 방어로직 포팅 1차 완료

This commit is contained in:
Your Name
2026-09-03 02:49:14 +09:00
parent ac1190f1fc
commit 3b7c21cde4
316 changed files with 56952 additions and 1 deletions

41
scratch/test_db_loader.py Normal file
View File

@@ -0,0 +1,41 @@
import os
import time
import sys
# 수동으로 .env 파일 파싱
env_path = "/home/hoon/kis_bot/.env"
if os.path.exists(env_path):
with open(env_path, "r") as f:
for line in f:
line = line.strip()
if line and not line.startswith('#') and '=' in line:
k, v = line.split('=', 1)
os.environ[k.strip()] = v.strip().strip("'\"")
user = os.environ.get("DB_USER", "root")
password = os.environ.get("DB_PASSWORD", "password")
host = os.environ.get("DB_HOST", "localhost")
port = os.environ.get("DB_PORT", "3306")
dbname = os.environ.get("DB_NAME", "TradeDB")
# sqlx 에서는 URL-encoded 패스워드가 필요할 수 있으나, 특수문자가 심하지 않으면 바로 사용
dsn = f"mysql://{user}:{password}@{host}:{port}/{dbname}"
print(f"DSN Ready: mysql://{user}:***@{host}:{port}/{dbname}")
import kis_rust_core
start = time.time()
try:
print("Requesting 10,000 candles from MariaDB directly via Rust...")
# 삼성전자(005930) 테스트
candles = kis_rust_core.load_candles_from_db(dsn, "005930", 10000)
elapsed = time.time() - start
print(f"=====================================")
print(f"🦀 RUST DB LOADER RESULT:")
print(f"Loaded {len(candles)} candles directly in {elapsed:.4f}s")
if candles:
print(f"First candle (Oldest): {candles[0].time_str} | Open: {candles[0].open}")
print(f"Last candle (Newest): {candles[-1].time_str} | Open: {candles[-1].open}")
print(f"=====================================")
except Exception as e:
print(f"Error: {e}")