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.

OrderDenied

OrderDenied records that the Nautilus system cannot submit an otherwise valid order, for example because of a risk limit or an unsupported feature. The execution pipeline applies it to the order, updates the Cache, and publishes it on the MessageBus.

The risk engine, execution engine, execution algorithms, and execution clients can all deny an order.

Typical transition: INITIALIZED -> DENIED. Handler: on_order_denied.

Fields

Beyond the common Python order event fields, OrderDenied carries:

FieldPython typeRequired/defaultDescription
reasonstrRequiredThe standardized denied reason code, with an optional diagnostic suffix.

Example

Reading the event in a strategy handler:

def on_order_denied(self, event: OrderDenied) -> None:
    self.log.warning(f"Order {event.client_order_id} denied: {event.reason}")
  • Events - Event categories, dispatch, and the common order event fields.
  • Execution - Risk checks and the pre-trade pipeline.
  • Order denied reasons - The standardized code set and message forms.
  • Orders - Order types and the state machine.

On this page