feat(tests): 신규 키움 웹소켓 조건검색 및 실시간 조건검색 테스트 추가
변경 사항 ---- - _test_kiwoom_condition_list.py: 키움 웹소켓 조건검색 '목록조회' 기능을 단독으로 테스트하는 스크립트 추가 - _test_kiwoom_condition_realtime.py: 'momentum' 조건식을 실시간으로 등록하고 초기 매칭 종목 리스트 및 실시간 편입/이탈을 수신하는 테스트 스크립트 추가 - _verify_columnar_bitid.py, _verify_shared_e2e_breakout.py, _verify_shared_e2e.py: 공유 메모리 및 dict 간의 데이터 일관성을 검증하는 테스트 추가 영향 ---- - 신규 테스트 스크립트 추가로 키움 웹소켓 API의 기능 검증 및 안정성을 높임 - 기존 기능에 대한 영향 없음 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
88
kis_trader/engine/range_break_env_keys.py
Normal file
88
kis_trader/engine/range_break_env_keys.py
Normal file
@@ -0,0 +1,88 @@
|
||||
"""
|
||||
kis_trader/engine/range_break_env_keys.py — 박스권 돌파(RANGE_BREAK) env 키 단일 정의
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
RANGE_BREAK_CONFIG_KEYS = frozenset({
|
||||
"RANGE_BREAK_BOX_LOOKBACK_MIN",
|
||||
"RANGE_BREAK_BOX_MAX_WIDTH_PCT",
|
||||
"RANGE_BREAK_BOX_MIN_WIDTH_PCT",
|
||||
"RANGE_BREAK_SETUP_VOL_MAX_MULT",
|
||||
"RANGE_BREAK_SETUP_BEAR_BARS_MIN",
|
||||
"RANGE_BREAK_VOL_MULT",
|
||||
"RANGE_BREAK_VOL_WIN",
|
||||
"RANGE_BREAK_BREAK_MARGIN_PCT",
|
||||
"RANGE_BREAK_BODY_MIN_PCT",
|
||||
"RANGE_BREAK_TIME_START",
|
||||
"RANGE_BREAK_TIME_END_HM",
|
||||
"RANGE_BREAK_STOP_LOSS_PCT",
|
||||
"RANGE_BREAK_TAKE_PROFIT_PCT",
|
||||
"RANGE_BREAK_TRAIL_PCT",
|
||||
"RANGE_BREAK_TRAIL_ARM_PCT",
|
||||
"RANGE_BREAK_SHOULDER_MIN_HIGH_PCT",
|
||||
"RANGE_BREAK_SHOULDER_CUT_PCT",
|
||||
"RANGE_BREAK_MAX_HOLD_BARS",
|
||||
"RANGE_BREAK_MAX_DAILY",
|
||||
"RANGE_BREAK_COOLDOWN_SEC",
|
||||
"RANGE_BREAK_MAX_DAILY_CHG",
|
||||
"RANGE_BREAK_MIN_PRICE",
|
||||
"RANGE_BREAK_HIGH_CHASE_THR",
|
||||
"RANGE_BREAK_USE_HIGH_CHASE_FILTER",
|
||||
"RANGE_BREAK_MAX_LOSS_PER_TRADE_KRW",
|
||||
"RANGE_BREAK_SLOT_MONEY",
|
||||
"RANGE_BREAK_MAX_STOCKS",
|
||||
"RANGE_BREAK_TOTAL_BUDGET_KRW",
|
||||
"RANGE_BREAK_MAX_BUY_AMOUNT",
|
||||
"RANGE_BREAK_LIVE_BACKTEST_ALIGN",
|
||||
"RANGE_BREAK_LIVE_SIGNAL_LOOKBACK_BARS",
|
||||
"RANGE_BREAK_FORCE_EOD_EXIT",
|
||||
"STRATEGY_RANGE_BREAK_ENABLED",
|
||||
"RANGE_BREAK_UNIVERSE_SOURCE",
|
||||
"RANK_RANGE_BREAK_SORT",
|
||||
"RANK_RANGE_BREAK_LIMIT",
|
||||
"CONDITION_RANGE_BREAK_NAME",
|
||||
"CONDITION_RANGE_BREAK_SEQ",
|
||||
"RANGE_BREAK_CAND_LIMIT",
|
||||
"KIS_RANGE_BREAK_MM_CHANNEL",
|
||||
})
|
||||
|
||||
|
||||
def _row_val(row: Dict[str, Any], key: str, default: Any = None) -> Any:
|
||||
v = row.get(key)
|
||||
if v not in (None, "", "None"):
|
||||
return v
|
||||
return default
|
||||
|
||||
|
||||
def range_break_env_float(row: Dict[str, Any], key: str, default: float) -> float:
|
||||
v = _row_val(row, key)
|
||||
if v is None:
|
||||
return float(default)
|
||||
try:
|
||||
return float(v)
|
||||
except (TypeError, ValueError):
|
||||
return float(default)
|
||||
|
||||
|
||||
def range_break_env_int(row: Dict[str, Any], key: str, default: int) -> int:
|
||||
v = _row_val(row, key)
|
||||
if v is None:
|
||||
return int(default)
|
||||
try:
|
||||
return int(float(v))
|
||||
except (TypeError, ValueError):
|
||||
return int(default)
|
||||
|
||||
|
||||
def range_break_env_bool(row: Dict[str, Any], key: str, default: bool) -> bool:
|
||||
v = _row_val(row, key)
|
||||
if v is None:
|
||||
return default
|
||||
s = str(v).strip().lower()
|
||||
if s in ("1", "true", "t", "y", "yes", "on"):
|
||||
return True
|
||||
if s in ("0", "false", "f", "n", "no", "off", ""):
|
||||
return False
|
||||
return default
|
||||
Reference in New Issue
Block a user