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 represents an order having been denied by the Nautilus system. The execution pipeline applies it to the order, updates the Cache, and publishes it on the MessageBus. It fires when an otherwise valid order cannot be submitted, for example due to a risk limit or an unsupported feature. 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