{"record":{"id":"4f91bb7f7278a560","repo":"nautechsystems/nautilus_trader","slug":"coinbase-only-supports-l2-mbp-order-book-deltas","errorCode":null,"errorMessage":"Coinbase only supports L2_MBP order book deltas","messagePattern":"Coinbase only supports L2_MBP order book deltas","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/data/mod.rs","lineNumber":545,"sourceCode":"        let instruments = self.instruments.load();\n\n        if let Some(instrument) = instruments.get(&cmd.instrument_id) {\n            if let Err(e) = self\n                .data_sender\n                .send(DataEvent::Instrument(instrument.clone()))\n            {\n                log::error!(\"Failed to send instrument {}: {e}\", cmd.instrument_id);\n            }\n        } else {\n            log::warn!(\"Instrument {} not found in cache\", cmd.instrument_id);\n        }\n\n        Ok(())\n    }\n\n    fn subscribe_book_deltas(&mut self, subscription: SubscribeBookDeltas) -> anyhow::Result<()> {\n        if subscription.book_type != BookType::L2_MBP {\n            anyhow::bail!(\"Coinbase only supports L2_MBP order book deltas\");\n        }\n\n        let ws = self.ws_client.clone();\n        let subscribed_id = Self::product_id(subscription.instrument_id);\n        let wire_id = self.resolve_wire_product_id(subscribed_id);\n        if wire_id != subscribed_id {\n            ws.register_subscription_alias(wire_id, subscribed_id);\n        }\n\n        self.spawn_command(async move {\n            if let Err(e) = ws.subscribe(CoinbaseWsChannel::Level2, &[wire_id]).await {\n                log::error!(\"Failed to subscribe to book deltas: {e:?}\");\n            }\n        });\n\n        Ok(())\n    }\n","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/data/mod.rs#L527-L563","documentation":"Coinbase's adapter only supports L2_MBP (market-by-price level 2) order books. subscribe_book_deltas rejects any SubscribeBookDeltas command whose book_type is not BookType::L2_MBP, because Coinbase's WS feed delivers level-2 price-level deltas only.","triggerScenarios":"Subscribing to order book deltas with BookType::L1_MBP or L3_MBP via subscribe_book_deltas on the Coinbase data client.","commonSituations":"Porting a strategy configured for another venue's L3 data; reusing a shared book config across adapters; defaulting book_type to L1 for top-of-book strategies.","solutions":["Set the subscription's BookType to BookType::L2_MBP","If you need L1, subscribe to quotes/ticker data instead of book deltas","If you need L3 (order-by-order) data, use a venue that publishes it; Coinbase does not","Verify the DataEngine/book config that builds the SubscribeBookDeltas command"],"exampleFix":"// before\nlet cmd = SubscribeBookDeltas { book_type: BookType::L3_MBP, .. };\nclient.subscribe_book_deltas(cmd)?;\n\n// after\nlet cmd = SubscribeBookDeltas { book_type: BookType::L2_MBP, .. };\nclient.subscribe_book_deltas(cmd)?;","handlingStrategy":"validation","validationCode":"if subscription.book_type != BookType::L2_MBP {\n    return Err(anyhow!(\"Coinbase requires L2_MBP book type\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin BookType::L2_MBP in venue-specific configs for Coinbase","Keep per-venue book-type settings out of shared strategy config","Use quotes/tick data when only top-of-book is needed","Document Coinbase's L2-only depth in your venue abstraction"],"tags":["orderbook","unsupported-operation","rust","config"],"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-14T00:17:10.932Z"}