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:
No handshake authentication is required. Address-scoped subscriptions include the master or subaccount address in the JSON message.
Public streams
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
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:
- Reconnect with exponential backoff and jitter.
- Resubscribe to the exact desired set.
- Treat new
isSnapshot: trueaccount messages as replacement baselines. - Replace local
l2Bookstate with the first new snapshot. - Query
/infofor 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.