feat: Add DART strategy and related configurations
ㅇ Changes: - Introduced the DART strategy to the trading system, including its configuration and integration into the existing framework. - Updated the database schema to include DART-specific tables for disclosures and watchlists. - Enhanced the backtesting and parameter search functionalities to support the DART strategy. - Implemented new rules for browser verification and API interactions to ensure compliance with the updated DART strategy. Impact: - These additions expand the trading capabilities of the system, allowing for more comprehensive analysis and execution of DART-related strategies, while maintaining system integrity and performance.
This commit is contained in:
@@ -160,7 +160,18 @@ def _load_target_codes(
|
||||
|
||||
|
||||
# ─── DB UPSERT 헬퍼 ────────────────────────────────────────────────────
|
||||
_INSERT_SQL = """
|
||||
# WS_CANDLE_FREEZE_ON_CONFIRM(기본 true): 존재 행 OHLCV 유지 — docs/정합성.md
|
||||
_INSERT_SQL_FREEZE = """
|
||||
INSERT INTO ws_candles
|
||||
(code, timeframe, candle_time, `open`, high, low, close,
|
||||
volume, rsi_2, rsi_3, rsi_5, is_confirmed, source, updated_at)
|
||||
VALUES
|
||||
(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
candle_time=candle_time
|
||||
"""
|
||||
|
||||
_INSERT_SQL_OVERWRITE = """
|
||||
INSERT INTO ws_candles
|
||||
(code, timeframe, candle_time, `open`, high, low, close,
|
||||
volume, rsi_2, rsi_3, rsi_5, is_confirmed, source, updated_at)
|
||||
@@ -173,6 +184,14 @@ _INSERT_SQL = """
|
||||
"""
|
||||
|
||||
|
||||
def _insert_sql() -> str:
|
||||
from kis_trader.utils.env import get_env_bool
|
||||
|
||||
if get_env_bool("WS_CANDLE_FREEZE_ON_CONFIRM", True):
|
||||
return _INSERT_SQL_FREEZE
|
||||
return _INSERT_SQL_OVERWRITE
|
||||
|
||||
|
||||
def _upsert_candles(
|
||||
db: TradeDB,
|
||||
code: str,
|
||||
@@ -214,7 +233,7 @@ def _upsert_candles(
|
||||
with db.conn._lock:
|
||||
db.conn._ensure_connected()
|
||||
cur = db.conn._conn.cursor()
|
||||
cur.executemany(_INSERT_SQL, rows)
|
||||
cur.executemany(_insert_sql(), rows)
|
||||
db.conn._conn.commit()
|
||||
|
||||
return len(rows)
|
||||
|
||||
Reference in New Issue
Block a user