Nightly 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.
A fill carrying a trade_id already on the order at a new last_px is a price restatement. It
restates the trade's accounting price and applies no quantity, status change, or portfolio economics.
Handlers that accumulate last_qty across fill events must skip restatements. Detect them by checking
order.events for an earlier OrderFilled with the same trade_id and a different event_id.
Fields
Beyond the common Python order event fields,
OrderFilled carries:
| Field | Python type | Required/default | Description |
|---|---|---|---|
venue_order_id | VenueOrderId | Required | The venue-assigned order identifier. |
account_id | AccountId | Required | The account associated with the fill. |
trade_id | TradeId | Required | The trade match ID assigned by the venue. |
position_id | PositionId or None | None | The position ID associated with the fill. |
order_side | OrderSide | Required | The execution order side. |
order_type | OrderType | Required | The execution order type. |
last_qty | Quantity | Required | The fill quantity for this execution. |
last_px | Price | Required | The fill price for this execution, not the average price. |
currency | Currency | Required | The currency of the fill price. |
commission | Money or None | None | The fill commission, if reported. |
liquidity_side | LiquiditySide | Required | The execution liquidity side (MAKER, TAKER, or NO_LIQUIDITY_SIDE). |
info | dict[str, str] or None | None | Additional venue-specific or adapter-specific fill metadata. |
reconciliation | bool | Required | If 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}",
)Related guides
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...
OrderFillVoided
OrderFillVoided records that all or part of a previously reported fill no longer has economic effect. The ExecutionEngine applies each successful correction...