NautilusTrader
ConceptsEvents
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.

OrderCanceled

OrderCanceled records an order reaching the terminal CANCELED state. The execution pipeline applies it to the order, updates the Cache, and publishes it on the MessageBus. It can come from a trading venue, simulated matching engine, local order emulator, or reconciliation. Reconciliation can create it from a venue report or from a local timeout or missing-order policy.

Typical transitions: PENDING_CANCEL/ACCEPTED -> CANCELED. External and recovery paths also allow INITIALIZED, EMULATED, RELEASED, SUBMITTED, PENDING_UPDATE, TRIGGERED, or PARTIALLY_FILLED -> CANCELED. A re-close can append CANCELED while the order is already canceled when a late fill arrived after its earlier cancellation. Handler: on_order_canceled.

Fields

Beyond the common Python order event fields, OrderCanceled carries:

FieldPython typeRequired/defaultDescription
venue_order_idVenueOrderId or NoneNoneThe venue-assigned order identifier, if known.
account_idAccountId or NoneNoneThe account associated with the order, if known.
reasonstr or NoneNoneThe cancellation reason supplied by the venue.
reconciliationboolRequiredIf reconciliation generated the event; this does not imply venue confirmation.

Example

Reading the event in a strategy handler:

def on_order_canceled(self, event: OrderCanceled) -> None:
    self.log.info(f"Order {event.client_order_id} canceled")
  • Events - Event categories, dispatch, and the common order event fields.
  • Orders - Order types and the state machine.
  • Execution policies - Venue evidence and synthetic terminal policies.

On this page