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

OrderFilled

OrderFilled records a partial or full execution against an order. The ExecutionEngine applies it to the order, updates the Cache, and publishes it on the MessageBus. Fills from live execution, reconciliation, and simulated matching drive the position lifecycle events.

Typical transition: ACCEPTED -> FILLED / PARTIALLY_FILLED. Handler: on_order_filled.

Fields

Beyond the common Python order event fields, OrderFilled carries:

FieldPython typeRequired/defaultDescription
venue_order_idVenueOrderIdRequiredThe venue‑assigned order identifier.
account_idAccountIdRequiredThe account associated with the fill.
trade_idTradeIdRequiredThe trade match ID assigned by the venue.
position_idPositionId or NoneNoneThe position ID associated with the fill.
order_sideOrderSideRequiredThe execution order side.
order_typeOrderTypeRequiredThe execution order type.
last_qtyQuantityRequiredThe fill quantity for this execution.
last_pxPriceRequiredThe fill price for this execution, not the average price.
currencyCurrencyRequiredThe currency of the fill price.
commissionMoney or NoneNoneThe fill commission, if reported.
liquidity_sideLiquiditySideRequiredThe execution liquidity side (MAKER, TAKER, or NO_LIQUIDITY_SIDE).
infodict[str, str] or NoneNoneAdditional venue‑ or adapter‑specific fill metadata.
reconciliationboolRequiredIf the event was generated during reconciliation.

Example

Reading the event in a strategy handler:

def on_order_filled(self, event: OrderFilled) -> None:
    self.log.info(
        f"Filled {event.last_qty} @ {event.last_px} "
        f"({event.liquidity_side}) commission={event.commission}",
    )
  • Events - Event categories, dispatch, and the common order event fields.
  • Positions - Positions created and modified from fills.
  • Orders - Order types and the state machine.

On this page