{"record":{"id":"3f88e4aa66c2373a","repo":"nautechsystems/nautilus_trader","slug":"no-order-book-data-found-for-instrument-instrume","errorCode":null,"errorMessage":"No order book data found for instrument '{instrument_id}' when `book_type` is '{:?}'. Set the venue `book_type` to 'L1_MBP' (for top-of-book data like quotes, trades, and bars) or provide order book data for this instrument.","messagePattern":"No order book data found for instrument '(.+?)' when `book_type` is '(.+?)'\\. Set the venue `book_type` to 'L1_MBP' \\(for top-of-book data like quotes, trades, and bars\\) or provide order book data for this instrument\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/backtest/src/engine.rs","lineNumber":749,"sourceCode":"            self.sorted,\n            \"Data has been added but not sorted, call `engine.sort_data()` or use \\\n             `engine.add_data(..., sort=true)` before running\"\n        );\n\n        for exchange in self.venues.values() {\n            let exchange = exchange.borrow();\n            let book_type_has_depth = exchange.book_type() as u8 > BookType::L1_MBP as u8;\n            if !book_type_has_depth {\n                continue;\n            }\n\n            for instrument_id in exchange.instrument_ids() {\n                let has_data = self.has_data.contains(instrument_id);\n                let missing_book_data = !self.has_book_data.contains(instrument_id)\n                    && !self.has_book_processed.contains(instrument_id);\n\n                if has_data && missing_book_data {\n                    anyhow::bail!(\n                        \"No order book data found for instrument '{instrument_id}' when `book_type` \\\n                         is '{:?}'. Set the venue `book_type` to 'L1_MBP' (for top-of-book data \\\n                         like quotes, trades, and bars) or provide order book data for this \\\n                         instrument.\",\n                        exchange.book_type()\n                    );\n                }\n            }\n        }\n\n        // Determine time boundaries\n        let start_ns = start.unwrap_or_else(|| self.ts_first.unwrap_or_default());\n        let end_ns = end.unwrap_or_else(|| self.ts_last_data.unwrap_or(start_ns));\n        anyhow::ensure!(start_ns <= end_ns, \"start was > end\");\n        self.end_ns = end_ns;\n        self.last_ns = start_ns;\n        self.last_module_ns = None;\n","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/backtest/src/engine.rs#L731-L767","documentation":"Venues configured with an L2/L3 MBP book_type need actual order book data to process deltas; if an instrument has other data (quotes/trades/bars) but no book data, the engine bails at run start because the configured book type cannot be maintained.","triggerScenarios":"add_venue with book_type L2_MBP (or L3) while only quotes/trades/bars were added for that instrument; book data never added via add_data; book data added but not registered under the instrument id.","commonSituations":"Reusing a venue config written for order-book data with a quote/trade dataset; forgetting to add the L1/L2 data files; instrument id mismatch so book data isn't attributed.","solutions":["Set the venue book_type to L1_MBP in the SimulatedVenueConfig when using quotes/trades/bars","Add order book data (OrderBookDelta/Depth) for every instrument with data on that venue","Verify the book data's instrument_id matches the exchange instrument_ids"],"exampleFix":"// before\nconfig.book_type = BookType::L2_MBP;\n// after\nconfig.book_type = BookType::L1_MBP; // top-of-book from quotes/trades/bars","handlingStrategy":"validation","validationCode":"for instrument_id in book_instrument_ids {\n    anyhow::ensure!(\n        has_book_data(&engine, instrument_id) || venue_config.book_type == BookType::L1_MBP,\n        \"instrument {instrument_id} lacks book data for {:?}\", venue_config.book_type\n    );\n}","typeGuard":null,"tryCatchPattern":"match engine.run(...) {\n    Err(e) if e.to_string().contains(\"No order book data found\") => {\n        eprintln!(\"switch venue book_type to L1_MBP or add book data: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Match book_type to the data you actually have (L1 for quotes/trades/bars)","Ensure every instrument added to an L2/L3 venue has order book data","Verify instrument_id consistency between book data files and venue instruments"],"tags":["backtest","order-book","configuration"],"backgroundTag":"invalid-config-value","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"}