NautilusTrader
ConceptsEvents

Nightly docs

These docs track unreleased changes and may change without notice. Their code examples can use APIs that the latest release lacks, so run them with a development wheel or switch to the latest release docs.

OrderExpired

OrderExpired records that an order has expired. 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, or reconciliation, for example when a GTD order reaches its expiry.

Typical transition: ACCEPTED -> EXPIRED. Handler: on_order_expired.

Fills received after expiry still update the order and position. A partial fill keeps the order EXPIRED; a fill that completes its quantity changes it to FILLED. If a fill arrives after the most recent expiry and the order is still EXPIRED or FILLED, the next OrderExpired is recorded and published without changing the order's status or timestamps. Further expiry events are rejected until another fill arrives.

Fields

Beyond the common Python order event fields, OrderExpired 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.
reconciliationboolRequiredIf generated during reconciliation.

Example

Reading the event in a strategy handler:

def on_order_expired(self, event: OrderExpired) -> None:
    self.log.info(f"Order {event.client_order_id} expired")
  • Events - Event categories, dispatch, and the common order event fields.
  • Orders - Order types and the state machine.

On this page