feat(broker): KIS venue parameterization — OrderRequest.venue + EXCG_ID_DVSN_CD (REQ-117/118, BAT-056)
- OrderRequest.venue: str = "KRX" additive 추가 (기존 위치 인수 순서 불변) - BrokerPort.cancel_order: venue: str = "KRX" 파라미터 추가 - BrokerPort.get_current_price: market: str = "J" 파라미터 추가 - KISBroker.submit_order: EXCG_ID_DVSN_CD=req.venue 항상 명시 전송 - KISBroker.cancel_order: EXCG_ID_DVSN_CD=venue 항상 명시 전송 - KISBroker.get_current_price: FID_COND_MRKT_DIV_CODE=market 파라미터화 - PaperBroker: cancel_order/get_current_price 시그니처 정합 (venue/market 수신·무시) - poll_fill TR 유지 (TTTC8001R) — NXT 체결 포함 여부 미확인 open item (코드 주석 기록) - tests/adapters/broker/test_venue.py: REQ-117 AC-1~5 + REQ-118 AC-1~8 신규 17개 - docs: interface-contract.md OrderRequest/BrokerPort 섹션 + change log 추가 - docs: runtime-flows.md venue 전달 경로 명시 + change log 추가 결과: 794 passed, 47 skipped (기존 777+47 대비 신규 17개 추가 전부 통과) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
This commit is contained in:
@@ -21,6 +21,7 @@ class OrderRequest:
|
||||
qty: int
|
||||
limit_price: Optional[int] = None # None => market order
|
||||
order_type: str = "00" # KIS ORD_DVSN: 00 limit, 01 market
|
||||
venue: str = "KRX" # exchange venue (REQ-117): KRX | NXT | SOR
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -93,8 +94,13 @@ class BrokerPort(Protocol):
|
||||
"""Observe current fill status for a previously accepted order."""
|
||||
...
|
||||
|
||||
def cancel_order(self, broker_order_id: str, *, side: str, symbol: str, qty: int) -> bool:
|
||||
"""Best-effort cancel. Returns True if the broker accepted the cancel."""
|
||||
def cancel_order(self, broker_order_id: str, *, side: str, symbol: str, qty: int, venue: str = "KRX") -> bool:
|
||||
"""Best-effort cancel. Returns True if the broker accepted the cancel.
|
||||
|
||||
venue: exchange venue of the original order (REQ-118). Cancel must use
|
||||
the same EXCG_ID_DVSN_CD as the original submit. Default "KRX" preserves
|
||||
backward compatibility for existing callers (orb/tsl).
|
||||
"""
|
||||
...
|
||||
|
||||
def get_balance(self) -> list[BalanceItem]:
|
||||
@@ -106,12 +112,15 @@ class BrokerPort(Protocol):
|
||||
"""
|
||||
...
|
||||
|
||||
def get_current_price(self, symbol: str) -> Optional[Decimal]:
|
||||
def get_current_price(self, symbol: str, market: str = "J") -> Optional[Decimal]:
|
||||
"""Return the current traded price (`stck_prpr`) for a symbol (REQ-038).
|
||||
|
||||
Used by the safety-sell worker to evaluate stop-loss/take-profit
|
||||
thresholds. Returns None when the price is unavailable (network error,
|
||||
unknown symbol, or — for the paper double — no programmed price).
|
||||
|
||||
market: KIS FID_COND_MRKT_DIV_CODE (REQ-118). Default "J" (KRX equities)
|
||||
preserves backward compatibility. Use "UN" for overseas/NXT extended session.
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user