nautechsystems/nautilus_trader · error

`OwnBookOrder` must have a price

Error message

`OwnBookOrder` must have a price

What it means

to_own_book_order() converts an order into an OwnBookOrder for the own-order book, and a limit-style order in the book must have a price. It panics when price() returns None, i.e. the order type carries no price (or was never priced).

Source

Thrown at crates/model/src/orders/mod.rs:526

            OrderStatus::Submitted | OrderStatus::PendingCancel | OrderStatus::PendingUpdate
        )
    }

    fn is_pending_update(&self) -> bool {
        self.status() == OrderStatus::PendingUpdate
    }

    fn is_pending_cancel(&self) -> bool {
        self.status() == OrderStatus::PendingCancel
    }

    fn to_own_book_order(&self) -> OwnBookOrder {
        OwnBookOrder::new(
            self.trader_id(),
            self.client_order_id(),
            self.venue_order_id(),
            self.order_side(),
            self.price().expect("`OwnBookOrder` must have a price"),
            self.leaves_qty(),
            self.order_type(),
            self.time_in_force(),
            self.status(),
            self.ts_last(),
            self.ts_accepted().unwrap_or_default(),
            self.ts_submitted().unwrap_or_default(),
            self.ts_init(),
        )
    }

    /// Builds an [`OrderStatusReport`] snapshot from the order's current state.
    ///
    /// Returns `None` if the order has no `venue_order_id` or `account_id`:
    /// a status report describes a venue-acknowledged order, and both fields
    /// are set by the time a venue acknowledges the order.
    fn to_order_status_report(&self, report_id: Option<UUID4>) -> Option<OrderStatusReport> {
        let account_id = self.account_id()?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure a price is set for price-bearing order types: builder.price(Price::from(...)) before build()
  2. Only feed LIMIT (or otherwise priced) orders into to_own_book_order(); skip market orders
  3. Guard with order.price().is_some() before conversion

Example fix

// before
let book_order = order.to_own_book_order();
// after
if order.price().is_none() {
    // market orders have no book price
    return;
}
let book_order = order.to_own_book_order();
Defensive patterns

Strategy: type-guard

Validate before calling

// Rust
if order.price().is_none() { return; } // skip market orders

Type guard

fn has_price(o: &dyn Order) -> bool { o.price().is_some() }

Prevention

When it happens

Trigger: Calling to_own_book_order() on a market-type order or an order built without .price(...) that nonetheless got tracked in the own order book.

Common situations: Registering market orders in an OwnBook-dependent flow; builder misuse where price was omitted for a LIMIT order; order-type/config mismatches after changing a strategy from LIMIT to MARKET.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/6aece470f99a33e6. Report an issue: GitHub.