{"record":{"id":"6aece470f99a33e6","repo":"nautechsystems/nautilus_trader","slug":"ownbookorder-must-have-a-price","errorCode":null,"errorMessage":"`OwnBookOrder` must have a price","messagePattern":"`OwnBookOrder` must have a price","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/mod.rs","lineNumber":526,"sourceCode":"            OrderStatus::Submitted | OrderStatus::PendingCancel | OrderStatus::PendingUpdate\n        )\n    }\n\n    fn is_pending_update(&self) -> bool {\n        self.status() == OrderStatus::PendingUpdate\n    }\n\n    fn is_pending_cancel(&self) -> bool {\n        self.status() == OrderStatus::PendingCancel\n    }\n\n    fn to_own_book_order(&self) -> OwnBookOrder {\n        OwnBookOrder::new(\n            self.trader_id(),\n            self.client_order_id(),\n            self.venue_order_id(),\n            self.order_side(),\n            self.price().expect(\"`OwnBookOrder` must have a price\"),\n            self.leaves_qty(),\n            self.order_type(),\n            self.time_in_force(),\n            self.status(),\n            self.ts_last(),\n            self.ts_accepted().unwrap_or_default(),\n            self.ts_submitted().unwrap_or_default(),\n            self.ts_init(),\n        )\n    }\n\n    /// Builds an [`OrderStatusReport`] snapshot from the order's current state.\n    ///\n    /// Returns `None` if the order has no `venue_order_id` or `account_id`:\n    /// a status report describes a venue-acknowledged order, and both fields\n    /// are set by the time a venue acknowledges the order.\n    fn to_order_status_report(&self, report_id: Option<UUID4>) -> Option<OrderStatusReport> {\n        let account_id = self.account_id()?;","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/mod.rs#L508-L544","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure a price is set for price-bearing order types: builder.price(Price::from(...)) before build()","Only feed LIMIT (or otherwise priced) orders into to_own_book_order(); skip market orders","Guard with order.price().is_some() before conversion"],"exampleFix":"// before\nlet book_order = order.to_own_book_order();\n// after\nif order.price().is_none() {\n    // market orders have no book price\n    return;\n}\nlet book_order = order.to_own_book_order();","handlingStrategy":"type-guard","validationCode":"// Rust\nif order.price().is_none() { return; } // skip market orders","typeGuard":"fn has_price(o: &dyn Order) -> bool { o.price().is_some() }","tryCatchPattern":null,"preventionTips":["Set .price(...) for every price-bearing order type in the builder","Only convert priced orders to OwnBookOrder","Match on order_type() to decide whether book registration applies"],"tags":["rust","panic","orders","own-book"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}