Recover a Hyperliquid order-book consumer after disconnect

Validate snapshots, update semantics and freshness before resuming a trading decision.

Choose the feed representation first

Hyperliquid's native l2Book subscription presents aggregated price-level book data. A provider can expose a different representation, such as book diffs. A full snapshot, a delta update and an order-level archive require different recovery logic. Never feed all three into the same update function.

Native subscription shape

{"method":"subscribe","subscription":{"type":"l2Book","coin":"BTC"}}

This example is the native Hyperliquid WebSocket format. It is not a Supanode endpoint request. Supanode's Hyperliquid streaming Docs define its own supported feeds and any provider-specific representation.

Recover conservatively

  1. Mark the book stale immediately when transport or freshness checks fail.
  2. Reconnect, resubscribe and obtain a valid baseline in the feed's documented format.
  3. For delta feeds, verify the documented ordering and continuity rules before applying buffered changes.
  4. Check bid/ask ordering, nonnegative quantities and freshness before allowing the strategy to use the book again.

Keep snapshots distinct from history

A fresh price-level snapshot can restore the current visible book, but it cannot recreate every update missed during the outage or the individual orders behind each level. If your strategy or research needs the exact earlier path, collect that path durably or use an appropriate archive. Compare these recovery semantics alongside connection count and price.

Sources

Continue reading