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:
Your Name
2026-07-21 07:50:24 +09:00
parent 74db49149f
commit 61bec4bd1d
86 changed files with 4811 additions and 297 deletions

View File

@@ -23,7 +23,8 @@ from kis_trader.utils.logger import get_logger
logger = get_logger("kis_trader.post_sell_candle_backfill")
_INSERT_SQL = """
# 존재 행 OHLCV 덮어쓰기(큰 volume 우선) — freeze OFF 일 때만
_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)
@@ -37,11 +38,31 @@ _INSERT_SQL = """
source=IF(VALUES(volume) > volume, VALUES(source), source)
"""
# freeze ON: 없는 분만 INSERT. 확정·미확정 행이 있으면 OHLCV 유지 (구멍 메우기 전용)
_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
"""
def post_sell_candle_backfill_enabled() -> bool:
return get_env_bool("POST_SELL_CANDLE_BACKFILL", True)
def _candle_freeze_on_confirm() -> bool:
"""docs/정합성.md — 확정 후 REST/백필이 봉을 키우지 않음. 기본 true."""
return get_env_bool("WS_CANDLE_FREEZE_ON_CONFIRM", True)
def _insert_sql() -> str:
return _INSERT_SQL_FREEZE if _candle_freeze_on_confirm() else _INSERT_SQL_OVERWRITE
def post_sell_candle_rollup_3m_enabled() -> bool:
"""1분 채운 뒤 3분 롤업 UPSERT (꼬리 TF 정합)."""
return get_env_bool("POST_SELL_CANDLE_ROLLUP_3M", True)
@@ -154,10 +175,11 @@ def _upsert_df_rows(db: Any, code: str, tf_min: int, rows: List[Dict[str, Any]])
continue
if not payload:
return 0
sql = _insert_sql()
with db.conn._lock:
db.conn._ensure_connected()
cur = db.conn._conn.cursor()
cur.executemany(_INSERT_SQL, payload)
cur.executemany(sql, payload)
db.conn._conn.commit()
return len(payload)