nautechsystems/nautilus_trader · error · anyhow::Error

Hyperliquid only supports L2_MBP order book deltas

Error message

Hyperliquid only supports L2_MBP order book deltas

What it means

The Hyperliquid data client only maintains L2 market-by-price (L2_MBP) order books. subscribe_book_deltas checks subscription.book_type and rejects anything else (e.g. L1_MBP or L3_MBP) because the venue's WebSocket feed cannot populate those book constructions.

Source

Thrown at crates/adapters/hyperliquid/src/data.rs:894

    fn subscribe_instrument(&mut self, cmd: SubscribeInstrument) -> anyhow::Result<()> {
        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!("Hyperliquid only supports L2_MBP order book deltas");
        }

        let ws = self.ws_client.clone();
        let instrument_id = subscription.instrument_id;
        let (n_sig_figs, mantissa) = parse_book_precision_params(subscription.params.as_ref())?;
        self.register_stream_health(MarketDataChannel::Deltas, instrument_id);

        self.spawn_task("subscribe_book_deltas", async move {
            ws.subscribe_book_with_options(instrument_id, n_sig_figs, mantissa)
                .await
        });

        Ok(())
    }

    fn subscribe_book_depth10(&mut self, subscription: SubscribeBookDepth10) -> anyhow::Result<()> {
        log::debug!(
            "Subscribing to book depth10: {}",

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set book_type=BookType::L2_MBP in the subscription for Hyperliquid order book data.
  2. Adjust the data engine/strategy config so Hyperliquid instruments request L2_MBP books.
  3. If L1/L3 semantics are required, use a venue that supports them; Hyperliquid cannot serve them.

Example fix

// before
request.book_type = BookType::L1_MBP;
// after
request.book_type = BookType::L2_MBP;
Defensive patterns

Strategy: validation

Validate before calling

assert_eq!(subscription.book_type, BookType::L2_MBP, "Hyperliquid requires L2_MBP book data");

Prevention

When it happens

Trigger: Subscribing to order book deltas with SubscribeBookDeltas whose book_type is not BookType::L2_MBP — e.g. a config setting book_type=L1_MBP for a Hyperliquid instrument.

Common situations: Sharing one subscription config across venues where another venue uses L1_MBP; default book type settings from a different adapter carried over to Hyperliquid.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/e367fecf77b86c17. Report an issue: GitHub.