{"record":{"id":"d627a1a5cc937cc3","repo":"nautechsystems/nautilus_trader","slug":"deribit-only-supports-l2-mbp-order-book-depth","errorCode":null,"errorMessage":"Deribit only supports L2_MBP order book depth","messagePattern":"Deribit only supports L2_MBP order book depth","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/data.rs","lineNumber":963,"sourceCode":"\n            let result = if interval == Some(DeribitUpdateInterval::Raw) {\n                ws.subscribe_book(instrument_id, interval).await\n            } else {\n                ws.subscribe_book_grouped(instrument_id, &group, depth, interval)\n                    .await\n            };\n\n            if let Err(e) = result {\n                log::error!(\"Failed to subscribe to book deltas for {instrument_id}: {e}\");\n            }\n        });\n\n        Ok(())\n    }\n\n    fn subscribe_book_depth10(&mut self, cmd: SubscribeBookDepth10) -> anyhow::Result<()> {\n        if cmd.book_type != BookType::L2_MBP {\n            anyhow::bail!(\"Deribit only supports L2_MBP order book depth\");\n        }\n\n        let instrument_id = cmd.instrument_id;\n        let needs_load = self.prepare_subscribe(instrument_id)?;\n\n        let ws = self\n            .ws_client\n            .as_ref()\n            .ok_or_else(|| anyhow::anyhow!(\"WebSocket client not initialized\"))?\n            .clone();\n        let http_client = self.http_client.clone();\n        let instruments = Arc::clone(&self.instruments);\n        let interval = self.get_interval(&cmd.params);\n        let group = cmd\n            .params\n            .as_ref()\n            .and_then(|p| p.get_str(\"group\"))\n            .unwrap_or(DERIBIT_BOOK_DEFAULT_GROUP)","sourceCodeStart":945,"sourceCodeEnd":981,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/data.rs#L945-L981","documentation":"subscribe_book_depth10 rejects the request because the requested book type is not L2_MBP; Deribit's fixed depth-10 book channel only provides level-2 merged price levels.","triggerScenarios":"Calling subscribe_book_depth10 with a SubscribeBookDepth10 command whose book_type is not BookType::L2_MBP.","commonSituations":"Generic strategy code that builds depth subscriptions with a venue-agnostic book_type; copying from Binance/Crypto.com style L3 examples; misconfigured DataEngine default book_type.","solutions":["Set book_type to BookType::L2_MBP on the depth10 subscription request","Use subscribe_book_deltas/subscribe_book_depth10 only for L2 data on Deribit","Validate book_type when constructing the command or client config"],"exampleFix":"// before\nlet cmd = SubscribeBookDepth10 { book_type: BookType::L3_MBP, .. };\n// after\nlet cmd = SubscribeBookDepth10 { book_type: BookType::L2_MBP, .. };","handlingStrategy":"validation","validationCode":"if cmd.book_type != BookType::L2_MBP {\n    return Err(anyhow::anyhow!(\"Deribit depth10 requires BookType::L2_MBP\"));\n}","typeGuard":"fn is_l2(book_type: BookType) -> bool { matches!(book_type, BookType::L2_MBP) }","tryCatchPattern":"if let Err(e) = client.subscribe_book_depth10(cmd).await {\n    if e.to_string().contains(\"L2_MBP\") { cmd.book_type = BookType::L2_MBP; retry(); }\n}","preventionTips":["Use BookType::L2_MBP for all Deribit depth subscriptions","Audit venue-agnostic subscription factories for L3 defaults","Fail fast at config validation, not at subscribe time"],"tags":["order-book","depth10","subscription","rust","deribit"],"backgroundTag":"unsupported-operation","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"}