nautechsystems/nautilus_trader · error
Coinbase only supports L2_MBP order book deltas
Error message
Coinbase only supports L2_MBP order book deltas
What it means
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.
Source
Thrown at crates/adapters/coinbase/src/data/mod.rs:545
let instruments = self.instruments.load();
if let Some(instrument) = instruments.get(&cmd.instrument_id) {
if let Err(e) = self
.data_sender
.send(DataEvent::Instrument(instrument.clone()))
{
log::error!("Failed to send instrument {}: {e}", cmd.instrument_id);
}
} else {
log::warn!("Instrument {} not found in cache", cmd.instrument_id);
}
Ok(())
}
fn subscribe_book_deltas(&mut self, subscription: SubscribeBookDeltas) -> anyhow::Result<()> {
if subscription.book_type != BookType::L2_MBP {
anyhow::bail!("Coinbase only supports L2_MBP order book deltas");
}
let ws = self.ws_client.clone();
let subscribed_id = Self::product_id(subscription.instrument_id);
let wire_id = self.resolve_wire_product_id(subscribed_id);
if wire_id != subscribed_id {
ws.register_subscription_alias(wire_id, subscribed_id);
}
self.spawn_command(async move {
if let Err(e) = ws.subscribe(CoinbaseWsChannel::Level2, &[wire_id]).await {
log::error!("Failed to subscribe to book deltas: {e:?}");
}
});
Ok(())
}
View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let cmd = SubscribeBookDeltas { book_type: BookType::L3_MBP, .. };
client.subscribe_book_deltas(cmd)?;
// after
let cmd = SubscribeBookDeltas { book_type: BookType::L2_MBP, .. };
client.subscribe_book_deltas(cmd)?; Defensive patterns
Strategy: validation
Validate before calling
if subscription.book_type != BookType::L2_MBP {
return Err(anyhow!("Coinbase requires L2_MBP book type"));
} Prevention
- 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
When it happens
Trigger: Subscribing to order book deltas with BookType::L1_MBP or L3_MBP via subscribe_book_deltas on the Coinbase data client.
Common situations: 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.
Related errors
- Binance Spot supports L1_MBP and L2_MBP order book subscript
- Invalid config type for AxExecutionClientFactory. Expected A
- `InstrumentId` not applicable to `Block`
- Invalid factory address for DEX {name} on chain {chain} for
- {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/4f91bb7f7278a560.
Report an issue: GitHub.