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

OrderFilled

OrderFilled represents an order having been filled at the exchange. The ExecutionEngine applies it to the order, updates the Cache, and publishes it on the MessageBus. It fires when the venue reports a partial or full execution against the order, and in turn drives the position events.

Transition: ACCEPTED -> FILLED / PARTIALLY_FILLED. Handler: on_order_filled.

Fields

Beyond the common order event fields, OrderFilled carries:

FieldPython typeRequired/defaultDescription
trade_idTradeIdRequiredThe trade match ID (assigned by the venue).
position_idPositionId or NoneRequiredThe position ID associated with the fill (assigned by the venue).
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.
commissionMoneyRequiredThe fill commission.
liquidity_sideLiquiditySideRequiredThe execution liquidity side (MAKER, TAKER, or NO_LIQUIDITY_SIDE).
infodict[str, object]NoneAdditional fill information (coerced to {} when omitted).

On this event, venue_order_id and account_id are populated, and reconciliation carries a real value.

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