nautechsystems/nautilus_trader · error
Binance Futures L1_MBP supports depth 1 only
Error message
Binance Futures L1_MBP supports depth 1 only
What it means
An L1_MBP book-deltas subscription maps to Binance's top-of-book (bookTicker-style) stream, which has no configurable depth. The adapter accepts `depth: None` or a depth of exactly 1; any other positive depth is rejected before the subscription is registered in `l1_book_subscriptions`, because Binance cannot honour a deeper book over the L1 stream.
Source
Thrown at crates/adapters/binance/src/futures/data.rs:1915
}
fn subscribe_instruments(&mut self, _cmd: SubscribeInstruments) -> anyhow::Result<()> {
log::debug!(
"subscribe_instruments: Binance Futures instruments are fetched via HTTP on connect"
);
Ok(())
}
fn subscribe_instrument(&mut self, _cmd: SubscribeInstrument) -> anyhow::Result<()> {
log::debug!(
"subscribe_instrument: Binance Futures instruments are fetched via HTTP on connect"
);
Ok(())
}
fn subscribe_book_deltas(&mut self, cmd: SubscribeBookDeltas) -> anyhow::Result<()> {
if cmd.book_type == BookType::L1_MBP {
anyhow::ensure!(
cmd.depth.is_none_or(|depth| depth.get() == 1),
"Binance Futures L1_MBP supports depth 1 only"
);
anyhow::ensure!(
!self.book_subscriptions.contains_key(&cmd.instrument_id),
"cannot subscribe L1_MBP and L2_MBP for the same Binance Futures instrument"
);
self.l1_book_subscriptions.rcu(|subscriptions| {
*subscriptions.entry(cmd.instrument_id).or_insert(0) += 1;
});
self.subscribe_top_of_book(cmd.instrument_id);
return Ok(());
}
if cmd.book_type != BookType::L2_MBP {
anyhow::bail!("Binance Futures supports L1_MBP and L2_MBP order book subscriptions");
}
anyhow::ensure!(View on GitHub (pinned to a4b06ed870)
Solutions
- Pass depth=None (or depth=1) for L1_MBP subscriptions
- If you actually need a deeper book, subscribe with BookType.L2_MBP and one of the valid depths [5, 10, 20, 50, 100, 500, 1000]
Example fix
# before actor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L1_MBP, depth=10) # after actor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L1_MBP, depth=None) # need depth? use L2: book_type=BookType.L2_MBP, depth=10
Defensive patterns
Strategy: validation
Validate before calling
def validate_l1_depth(depth) -> None:
if depth is not None and depth != 1:
raise ValueError('Binance Futures L1_MBP supports depth None or 1 only — pass depth=None')
validate_l1_depth(depth)
actor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L1_MBP, depth=None) Type guard
def is_valid_l1_depth(depth) -> bool:
return depth is None or depth == 1 Try / catch
try:
actor.subscribe_order_book_deltas(instrument_id, book_type=BookType.L1_MBP, depth=depth)
except Exception as e:
if 'L1_MBP supports depth 1 only' in str(e):
raise ValueError('Retrying with depth=None for the L1 top-of-book stream') from e
raise Prevention
- Never forward a depth parameter to L1 subscriptions — top-of-book has no depth by definition
- Centralise book subscription config; validate depth only for L2_MBP
When it happens
Trigger: `subscribe_book_deltas` / `subscribe_order_book_deltas` with `book_type=BookType.L1_MBP` and `depth` set to any value other than 1 (e.g. PositiveU16 of 5, 10, 100). Passing depth=None or omitting it is fine.
Common situations: Porting an existing L2_MBP config to L1 and leaving the depth parameter in place; generic subscription code that always forwards a depth; assuming depth is silently ignored for L1.
Related errors
- cannot subscribe L1_MBP and L2_MBP for the same Binance Futu
- Invalid depth {depth} for Binance Futures order book. Valid
- Binance Futures supports L1_MBP and L2_MBP order book subscr
- invalid Binance Futures order-book depth; valid values are {
- Binance Spot L1_MBP supports depth 1 only
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/8c7d0a0379a77443.
Report an issue: GitHub.