Skip to navigation

Hyperliquid real-time trading and account streams

This page covers Hyperliquid’s direct trading WebSocket. For normalized Predict account, outcome, and queue-position updates, use the Predict realtime API.

Connect Predict staging integrations to Hyperliquid testnet at:

wss://api.hyperliquid-testnet.xyz/ws

No handshake authentication is required. Address-scoped subscriptions include the master or subaccount address in the JSON message.

Public streams

Subscription typeData
allMidsMid-price map
l2BookFull replacement book snapshots
bboBest bid and offer when either changes
tradesPublic executions
candleLive OHLCV candles for one interval

Refresh the Predict Outcomes API when you need updated outcome labels, questions, lifecycle status, or settlement data. Hyperliquid WebSockets are documented only for trading and account state.

Account streams

Subscription typeData
openOrdersCurrent open-order snapshot
orderUpdatesOrder lifecycle changes
userFillsInitial fill snapshot, then live fills
spotStateUSDC and outcome-token balance state
userNonFundingLedgerUpdatesDeposits, withdrawals, transfers, and other ledger activity
notificationAccount notifications

Subscribe with { "method": "subscribe", "subscription": { ... } }. Unsubscribe by sending the identical subscription object with method: "unsubscribe". Wait for the subscriptionResponse acknowledgement.

Heartbeats and recovery

Hyperliquid closes a connection that has not received a server message for 60 seconds. Send { "method": "ping" } before that deadline on quiet connections and expect { "channel": "pong" }.

After every disconnect:

  1. Reconnect with exponential backoff and jitter.
  2. Resubscribe to the exact desired set.
  3. Treat new isSnapshot: true account messages as replacement baselines.
  4. Replace local l2Book state with the first new snapshot.
  5. Query /info for orders, fills, balances, and ledger ranges that may have changed while disconnected.

Do not apply l2Book messages as deltas and do not assume a sequence number that Hyperliquid does not provide.

Requests over WebSocket

Hyperliquid also accepts HTTP-equivalent info requests and fully signed actions through method: "post". Give each request a unique id; responses arrive on channel post with the same ID and a response type of info, action, or error. This can reduce connection overhead, but it does not change signing or response-validation rules.

Start with WebSocket Connection, then open the separate page for each subscription or message flow.