Skip to main content

FAQs

1. How do we connect to your feed and gateway to Hyperliquid?

  • Feed (market & account data)
    • HTTP (REST): the Info endpoint — POST https://<endpoint>/v1/hl/info — for snapshots & queries (mids, L2 book, trades, user fills, etc.).
    • WebSocket: low-latency, real-time streams and request/response over a single connection.
  • Gateway (trading/actions)
    • HTTP (REST): the Exchange endpoint — POST https://<endpoint>/v1/hl/exchange — for signed actions (place/modify/cancel orders, leverage, transfers, etc.).
    • WebSocket: you can also send signed actions over WS using:
      { "method": "post", "request": { "type": "action", "payload": { /* signed action */ } } }
    
Quick connect examples
  • Subscribe to trades over WS (feed):
wscat -c wss://<endpoint>/v1/hl/ws
# then send:
{ "method": "subscribe", "subscription": { "type": "trades", "coin": "SOL" } }
  • Fetch L2 snapshot over REST (feed):
curl -sX POST https://<endpoint>/v1/hl/info \
  -H 'Content-Type: application/json' \
  -d '{"type":"l2Book","coin":"ETH","nSigFigs":5,"mantissa":null}'
  • Place an order over REST (gateway):
curl -sX POST https://<endpoint>/v1/hl/exchange \
  -H 'Content-Type: application/json' \
  -d '{
    "action": {
      "type": "order",
      "orders": [{
        "a": 4,       // asset index
        "b": true,    // isBuy
        "p": "1100",  // price
        "s": "0.2",   // size
        "r": false,   // reduceOnly
        "t": { "limit": { "tif": "Gtc" } }
      }],
      "grouping": "na"
    },
    "nonce": 1713825891591,
    "signature": { "r":"...","s":"...","v":"..." }
  }'
Auth, nonces, and signing (must-know)
  • Use API wallets (“agent wallets”) approved by the master account to sign on behalf of master/sub-accounts; nonces are tracked per signer and must be within a moving time window.
  • Don’t reuse pruned agents; prefer one API wallet per process/sub-account to avoid nonce clashes.
  • Two signing schemes exist; minor serialization mistakes will break signatures — the docs strongly suggest starting from the Python SDK.

2. Should I use WebSocket or REST API for order placement in Hyperliquid?

Both are supported (same action payloads, same signatures). Choose based on latency profile & traffic pattern: Use WebSocket when you need:
  • Lowest latency & fewer TLS handshakes (long-lived connection).
  • High throughput / batching (many orders/cancels per second) while staying within WS limits (e.g., up to 2000 messages/min, 100 inflight posts across connections).
  • Unified pipe for both streaming fills/order updates and sending actions (method: “post”), simplifying coordination.
Use REST when you prefer:
  • Simplicity/reliability (stateless requests, easy retries, fits typical HTTP infra).
  • Lower request volume or cron/ops scenarios (e.g., scheduled rebalances) where WS overhead isn’t justified.
  • Note: IP-based rate weights - REST has ~1200 weight/min with per-endpoint weights (e.g., exchange weight ≈ 1 + floor(batch_length/40)). Address-based limits for actions still apply regardless of transport.
Practical rule of thumb:
  • Market-making / fast bots → WebSocket for both streaming & posting actions.
  • Back-office, dashboards, low-frequency trading → REST for actions; WS optional for real-time UX.
Don’t forget rate limits & IDs:
  • Respect both IP-based (per minute) and address-based (per user) limits.
  • Leverage batched actions to cut IP weight while minding address-based limits.
  • Use cloid for idempotency and reconciliation.

3. Are there code samples and SDKs available?

We will add Python/Rust/C++ samples, please stay tuned.