Skip to main content
Hyperliquid exposes a native WebSocket endpoint at wss://api.hyperliquid.xyz/ws. The SDK discovers this URL from the wsUrl field in the GET /providers response. If you’re using the SDK, see Streaming instead. For the full WebSocket protocol specification (message format, keepalive, and subscription channels), see the Hyperliquid WebSocket documentation.

SDK Channel Mapping

The SDK maps between normalized channel names and Hyperliquid-native channels: marketContext subscribes to Hyperliquid’s activeAssetCtx feed for the requested marketId. Each emitted SDK event contains a normalized MarketContext snapshot with mark price, oracle price, previous-day price, 24h volume, open interest, and funding when the venue includes them. marketsContext combines Hyperliquid’s compressed asset-context feeds with fastAssetCtxs, so the SDK can stream the all-market context map while keeping high-frequency mid and mark prices fresh. orderUpdates orders are upserts of any status (terminal ones included); terminated lists order ids that reached a terminal status and should be evicted from your cache. positions and accountSummary are two normalized views over the same allDexsClearinghouseState wire subscription — subscribing to both for one address opens a single upstream feed. positions events are full snapshots: replace your state, never merge. The accountSummary.portfolioValue on the socket depends on the account mode. For an account in unified or portfolio-margin mode, portfolioValue already includes the spot collateral and the spot balances, so do not add spotBalances to it. For every other account mode, portfolioValue covers perps equity only. Spot balances stream separately on spotBalances, so combine the two for a total equal to REST getAccountSummary(). Account channels check preTransferCheck.userExists before opening the upstream subscription. orderUpdates, fills, positions, spotBalances, accountSummary, and availableToTrade reject with AccountNotFound when the wallet has no Hyperliquid account; no subscription is sent.

Rate Limits

Hyperliquid enforces these limits; the SDK does not enforce them:
  • 1000 total subscriptions per WebSocket connection
  • 10 unique user addresses across user-specific subscriptions (orderUpdates, userFills, allDexsClearinghouseState, spotState, activeAssetData) per IP. The SDK opens one to three user-wire subscriptions per address
  • 10 connections, 30 new connections per minute, 2000 messages per minute, and 100 in-flight posts. See the Hyperliquid rate limits