fix(execution): fail closed on unresolved orders
This commit is contained in:
@@ -376,6 +376,14 @@ class KISBroker:
|
||||
) -> FillStatus:
|
||||
if broker_order_id.startswith(_SUBMISSION_UNKNOWN_PREFIX):
|
||||
return self._poll_unknown_submission(broker_order_id, side=side, symbol=symbol)
|
||||
if order_date is None:
|
||||
# A legacy pending row has no authoritative date anchor. ODNO is
|
||||
# reusable, so querying today's rows could attach another order's
|
||||
# terminal evidence to this slot. Never invent an inquiry date.
|
||||
return FillStatus(
|
||||
state="unknown",
|
||||
raw={"reason": "order_reconciliation_metadata_unknown"},
|
||||
)
|
||||
now = monotonic()
|
||||
if now < self._fill_poll_not_before.get(broker_order_id, 0.0):
|
||||
return FillStatus(
|
||||
@@ -386,7 +394,7 @@ class KISBroker:
|
||||
# open duplicate KIS inquiries for the same order.
|
||||
self._fill_poll_not_before[broker_order_id] = now + _FILL_POLL_MIN_INTERVAL_SECONDS
|
||||
odno = broker_order_id.split(":")[-1]
|
||||
inquiry_date = order_date or self._clock().astimezone(_KST).strftime("%Y%m%d")
|
||||
inquiry_date = order_date
|
||||
tr_id, params = self._daily_fill_request(inquiry_date, order_number=odno)
|
||||
try:
|
||||
resp = httpx.get(
|
||||
|
||||
Reference in New Issue
Block a user