fix: preserve sell event routing owner
This commit is contained in:
@@ -469,6 +469,18 @@ class IntentService:
|
||||
return IntentDecision(
|
||||
intent.intent_id, "rejected", None, f"slot_not_holding:{slot.status.value}"
|
||||
)
|
||||
# req-0011 / ac-0038: decide the SELL event owner at admission and
|
||||
# persist it in the existing canonical slot field. An explicit SELL
|
||||
# owner wins, then a preserved owner from a prior zero-fill cancel,
|
||||
# then the legacy holding owner used by autonomous safety sells.
|
||||
def non_empty(value: Optional[str]) -> Optional[str]:
|
||||
return value if isinstance(value, str) and value.strip() else None
|
||||
|
||||
sell_event_owner = (
|
||||
non_empty(intent.sell_strategy_id)
|
||||
or non_empty(slot.sell_strategy_id)
|
||||
or non_empty(slot.strategy_id)
|
||||
)
|
||||
# dcy-022 / REQ-068: resolve effective timeout.
|
||||
effective_timeout = (
|
||||
intent.timeout_sec
|
||||
@@ -482,7 +494,7 @@ class IntentService:
|
||||
SlotState.PENDING_SELL,
|
||||
reason=intent.reason,
|
||||
actor="intent_api",
|
||||
sell_strategy_id=intent.sell_strategy_id,
|
||||
sell_strategy_id=sell_event_owner,
|
||||
# dcy-012 / REQ-007: optional sell limit (None => market sell).
|
||||
limit_price=intent.limit_price,
|
||||
# dcy-021 / REQ-062: partial-sell order qty (None => sell all);
|
||||
|
||||
Reference in New Issue
Block a user