{"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":1985,"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        self.book_subscriptions.insert(instrument_id, depth);\n","sourceCodeStart":1967,"sourceCodeEnd":2003,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/data.rs#L1967-L2003","documentation":"Guard in subscribe_book_deltas rejecting book types other than L1_MBP and L2_MBP (e.g. L3_MBO): Binance Futures exposes no L3 feed, so such a subscription cannot be served and is rejected before any channel is opened.","triggerScenarios":"subscribe_book_deltas called with cmd.book_type neither L1_MBP nor L2_MBP (e.g. L3_MBP).","commonSituations":"Configuring a strategy with L3 order book data and routing it to the Binance Futures adapter, or a generic catalog config that doesn't constrain book_type per venue.","solutions":["Change the subscription's book_type to L2_MBP (or L1_MBP)","Do not also keep an existing L1 subscription for the same instrument (that raises the separate conflicting-subscription error)","If L3 depth is required, use a different adapter/venue that supports it"],"exampleFix":"// before\nbook_type: BookType::L3_MBP,\n// after\nbook_type: BookType::L2_MBP,","handlingStrategy":"validation","validationCode":"assert!(matches!(cmd.book_type, BookType::L1_MBP | BookType::L2_MBP), \"Binance Futures supports only L1/L2 MBP\");","typeGuard":"fn is_supported_book_type(bt: &BookType) -> bool {\n    matches!(bt, BookType::L1_MBP | BookType::L2_MBP)\n}","tryCatchPattern":"match client.subscribe_book_deltas(cmd).await {\n    Err(e) if e.to_string().contains(\"supports L1_MBP and L2_MBP\") => return Err(anyhow::anyhow!(\"switch to L2_MBP: {e}\")),\n    other => other,\n}","preventionTips":["Constrain book_type per venue in strategy config","Never request L3 from Binance Futures","Ensure only L1 or L2 (not both) per instrument"],"tags":["rust","order-book","subscription","binance"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}