Nightly docs
OrderCancelDenied
OrderCancelDenied records a local refusal of a CancelOrder command that was not sent to its
execution target. The execution pipeline applies it to the order when cached and publishes it on the
MessageBus. Handler: on_order_cancel_denied.
The denial preserves the working order and its terms. See Command refusals for pending-command resolution, causation, and callback migration.
Fields
Beyond the common Python order event fields,
OrderCancelDenied carries:
| Field | Python type | Required/default | Description |
|---|---|---|---|
reason | str | Required | The reason the command was denied. |
venue_order_id | VenueOrderId or None | None | The venue-assigned order identifier, if known. |
account_id | AccountId or None | None | The account associated with the order, if known. |
Example
Reading the event in a strategy handler:
from nautilus_trader.model import OrderCancelDenied
def on_order_cancel_denied(self, event: OrderCancelDenied) -> None:
self.log.warning(
f"Cancel denied for {event.client_order_id}: {event.reason}",
)Related guides
OrderModifyRejected
OrderModifyRejected records that a ModifyOrder command was rejected. The ExecutionEngine applies it to the order, updates the Cache, and publishes it on the...
OrderCancelRejected
OrderCancelRejected records a trading venue or simulated matching engine rejecting a CancelOrder request. The ExecutionEngine applies it to the order...