{"record":{"id":"92b9e2e16c15d723","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-supports-l1-mbp-and-l2-mbp-order-b","errorCode":null,"errorMessage":"Binance Futures supports L1_MBP and L2_MBP order book subscriptions","messagePattern":"Binance Futures supports L1_MBP and L2_MBP order book subscriptions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":1931,"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 Futures 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 Futures 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 Futures 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 Futures instrument\"\n        );\n\n        let instrument_id = cmd.instrument_id;\n        let depth = cmd.depth.map_or(1000, |d| d.get() as u32);\n\n        if !BINANCE_BOOK_DEPTHS.contains(&depth) {\n            anyhow::bail!(\n                \"Invalid depth {depth} for Binance Futures order book. \\\n                Valid values: {BINANCE_BOOK_DEPTHS:?}\"\n            );\n        }\n\n        // Track subscription for reconnect handling\n        self.book_subscriptions.insert(instrument_id, depth);","sourceCodeStart":1913,"sourceCodeEnd":1949,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/data.rs#L1913-L1949","documentation":"Binance futures only publishes top-of-book and partial-depth order book streams, so the adapter accepts exactly `BookType::L1_MBP` and `BookType::L2_MBP` for book-deltas subscriptions. Any other BookType — most commonly `L3_MBO` — is rejected immediately with this bail, before depth or subscription state are even considered.","triggerScenarios":"`subscribe_book_deltas` with `book_type=BookType.L3_MBO` (or any variant other than L1_MBP/L2_MBP). The L1 branch runs first, so this error specifically means the type was neither.","commonSituations":"Strategies ported from venues that offer market-by-order feeds; config defaults assuming MBO is universal; copying a Coinbase/L3-style book config into a Binance futures run.","solutions":["Use BookType.L2_MBP (partial depth, valid depths 5/10/20/50/100/500/1000) for order book data on Binance Futures","Use BookType.L1_MBP for top-of-book only","If the strategy needs order-by-order updates, rework it against L2 deltas — Binance futures has no MBO stream to map to"],"exampleFix":"# before\nactor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L3_MBO)\n\n# after\nactor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L2_MBP, depth=100)","handlingStrategy":"type-guard","validationCode":"if book_type not in (BookType.L1_MBP, BookType.L2_MBP):\n    raise ValueError(f'Binance Futures order books support L1_MBP/L2_MBP only, got {book_type}')","typeGuard":"from nautilus_trader.model.enums import BookType\n\ndef is_supported_binance_book_type(book_type) -> bool:\n    return book_type in (BookType.L1_MBP, BookType.L2_MBP)","tryCatchPattern":"try:\n    actor.subscribe_order_book_deltas(instrument_id, book_type=book_type)\nexcept Exception as e:\n    if 'supports L1_MBP and L2_MBP' in str(e):\n        raise ValueError('Binance has no market-by-order feed; rework the strategy against L2 deltas') from e\n    raise","preventionTips":["Check the venue's supported book types before configuring a strategy — Binance futures is MBP-only","Gate L3_MBO code paths behind a venue capability check so they are never sent to this adapter"],"tags":["binance","futures","orderbook","book-type","l3-mbo"],"backgroundTag":"unsupported-book-type","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}