feat: Enhance trading system with new e_min_chg_pct parameter and related logic
Changes: - Introduced the `e_min_chg_pct` parameter to define the minimum price change percentage compared to the previous day's close, enhancing the momentum trading strategy. - Updated various functions and classes to incorporate this new parameter, ensuring it is utilized in both backtesting and live trading scenarios. - Improved documentation and comments to clarify the purpose and usage of the new parameter across the codebase. Impact: - This addition allows for more precise control over trading conditions, potentially increasing the effectiveness of the momentum strategy while maintaining system integrity and performance.
This commit is contained in:
@@ -951,10 +951,24 @@ class KISClient(SafeRequest):
|
||||
code=code, qty=qty, price=int(price), order_type="00", side="SELL"
|
||||
)
|
||||
|
||||
def uses_market_sell_ioc(self) -> bool:
|
||||
"""
|
||||
실전 시장가 매도 IOC(ORD_DVSN=13) 사용 여부.
|
||||
모의는 IOC/FOK 미지원 → 항상 False (주문은 01).
|
||||
"""
|
||||
if self.mock:
|
||||
return False
|
||||
return bool(get_env_bool("USE_MARKET_IOC_SELL", True))
|
||||
|
||||
def sell_market_order(self, code: str, qty: int) -> Optional[str]:
|
||||
"""시장가 매도. IOC 에러가 너무 빈번한 경우를 위해 기본 '01' 일반 시장가."""
|
||||
"""
|
||||
시장가 매도.
|
||||
- 모의: 항상 01 (일반 시장가)
|
||||
- 실전: USE_MARKET_IOC_SELL=true 이면 13(IOC), false 이면 01
|
||||
"""
|
||||
order_type = "13" if self.uses_market_sell_ioc() else "01"
|
||||
return self._order(
|
||||
code=code, qty=qty, price=0, order_type="01", side="SELL"
|
||||
code=code, qty=qty, price=0, order_type=order_type, side="SELL"
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user