Mainnet endpoints and responsibilities

The Info endpoint serves public and user state through POST request types. Exchange actions use signed payloads. WebSocket subscriptions stream trades, books, candles and user events depending on the subscription.

Keep testnet and mainnet configuration separate. Never let an environment default silently choose where a signed action is sent.

HTTP  https://api.hyperliquid.xyz
WS    wss://api.hyperliquid.xyz/ws
EVM   https://rpc.hyperliquid.xyz/evm

Normalize units at the boundary

Many numeric API fields arrive as decimal strings. Parse with a decimal-safe policy appropriate to your application and retain the raw value for auditing. In metaAndAssetCtxs, openInterest is base units while dayNtlVlm is notional volume.

This site derives estimated USD OI by multiplying base OI by mark price. It computes impact spread from impactPxs and mid price. Those derivations are tested and labeled in Market Pulse.

oiUsd = Number(ctx.openInterest) * Number(ctx.markPx)
spreadBps = (impactAsk - impactBid) / midPx * 10_000

WebSocket clients must recover

Official documentation warns that server-side disconnects can happen without announcement. Implement heartbeat detection, bounded exponential backoff, resubscription and snapshot reconciliation.

Do not append events blindly after reconnect. Establish the snapshot boundary, deduplicate by event identity where available and measure gaps.

Rate limits are weighted

The documented REST allowance is 1,200 weighted units per minute per IP. Request types have different weights; allMids and l2Book are lighter than many general Info requests. WebSocket connections and subscriptions have separate limits.

Batch and cache shared public data. Back off on 429 responses and avoid per-user polling when one server-side feed can fan out safely.

Start from the official Python SDK

The official hyperliquid-python-sdk repository includes examples for Info queries, WebSocket use and exchange actions. Pin a reviewed version, inspect signing code and load private keys from a secret manager or isolated environment.

Before a live order, validate tick size, size decimals, reduce-only intent, time in force and maximum acceptable slippage. Test cancellations and failure paths on testnet.

pip install hyperliquid-python-sdk
# Pin an audited version in production requirements.