{"record":{"id":"f98c5b6cb57bc4e1","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-supports-l1-mbp-and-l2-mbp-order-book","errorCode":null,"errorMessage":"Binance Spot supports L1_MBP and L2_MBP order book subscriptions","messagePattern":"Binance Spot supports L1_MBP and L2_MBP order book subscriptions","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/data.rs","lineNumber":1832,"sourceCode":"    fn subscribe_book_deltas(&mut self, cmd: SubscribeBookDeltas) -> anyhow::Result<()> {\n        if cmd.book_type == BookType::L1_MBP {\n            anyhow::ensure!(\n                cmd.depth.is_none_or(|depth| depth.get() == 1),\n                \"Binance Spot L1_MBP supports depth 1 only\"\n            );\n            anyhow::ensure!(\n                !self.book_subscriptions.contains_key(&cmd.instrument_id),\n                \"cannot subscribe L1_MBP and L2_MBP for the same Binance Spot instrument\"\n            );\n            self.l1_book_subscriptions.rcu(|subscriptions| {\n                *subscriptions.entry(cmd.instrument_id).or_insert(0) += 1;\n            });\n            self.subscribe_top_of_book(cmd.instrument_id);\n            return Ok(());\n        }\n\n        if cmd.book_type != BookType::L2_MBP {\n            anyhow::bail!(\"Binance Spot supports L1_MBP and L2_MBP order book subscriptions\");\n        }\n        anyhow::ensure!(\n            !self.l1_book_subscriptions.contains_key(&cmd.instrument_id),\n            \"cannot subscribe L1_MBP and L2_MBP for the same Binance Spot instrument\"\n        );\n\n        let instrument_id = cmd.instrument_id;\n        let ws = self.ws_client.clone();\n        let symbol_lower = instrument_id.symbol.as_str().to_lowercase();\n\n        if self.spot_market_data_mode == BinanceSpotMarketDataMode::Json && cmd.depth.is_some() {\n            // Explicit depth requests use partial-book streams. Full-depth JSON\n            // subscriptions fall through to the REST snapshot + @depth diff path.\n            let depth_level = match cmd.depth.map(|d| d.get()) {\n                Some(1..=5) => 5,\n                Some(6..=10) => 10,\n                _ => 20,\n            };","sourceCodeStart":1814,"sourceCodeEnd":1850,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/data.rs#L1814-L1850","documentation":"Binance Spot order book subscriptions accept only L1_MBP (top of book) and L2_MBP (aggregated depth); the venue exposes no L3/order-by-order data on these streams, so any other BookType (typically L3_MBP) is rejected immediately.","triggerScenarios":"subscribe_book_deltas with book_type set to L3_MBP (or any type other than L1_MBP/L2_MBP) on a Binance Spot instrument.","commonSituations":"Porting a strategy from a venue that provides L3 (e.g. some crypto exchanges or FX feeds) without adjusting the book type; generic book-subscription presets that default to L3.","solutions":["Request L2_MBP for aggregated depth or L1_MBP for top of book on Binance Spot","If order-by-order data is a hard requirement, use a venue/adapter that provides L3 data"],"exampleFix":"# before\nclient.subscribe_book_deltas(\n    instrument_id,\n    BookType.L3_MBP,  # errors: not offered on Binance Spot\n    depth=None,\n)\n\n# after\nclient.subscribe_book_deltas(\n    instrument_id,\n    BookType.L2_MBP,\n    depth=None,\n)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"from nautilus_trader.model.data import BookType\n\ndef is_supported_binance_spot_book_type(book_type) -> bool:\n    return book_type in (BookType.L1_MBP, BookType.L2_MBP)","tryCatchPattern":null,"preventionTips":["Check BookType against the venue's supported set before subscribing","Keep venue capability tables in config instead of assuming uniform L3 support"],"tags":["binance","spot","order-book","l3-mbp","unsupported-feature","validation"],"backgroundTag":"unsupported-book-type","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}