Skip to main content

Documentation Index

Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

Credit Cost

0.1 per coin per minute

Processing

Realtime
  • GoldRush-native. l2BookDiff is not exposed on wss://api.hyperliquid.xyz/ws. Pointing a client at the public endpoint with this subscription type will fail.
  • Snapshot, then diffs. The first message is always a Snapshot; every message thereafter is an Updates. Clients must seed local book state from the snapshot and apply diffs from there. On reconnect, drop local state and re-seed from the next snapshot.
  • coin is optional. Omit it to stream the entire L2 order book across every asset on a single subscription.
  • When coin is omitted, the optional marketTypes filter selects which market families to include. It defaults to ["perp"] only.
  • Pass "marketTypes": ["spot"], or "marketTypes":["outcome"], or a mix (e.g. "marketTypes": ["perp","spot"]), or use the wildcard "marketTypes": ["*"] to opt into spot, perps, outcome, and any future market types.
  • No 1000-subscription-per-IP cap - multiplex hundreds of l2BookDiff subscriptions on a single connection.
  • For OHLCV candles instead of raw book state, use the Streaming API OHLCV streams.
Note: When coin is omitted, a credit rate of 10 credits per minute subscribed is applied.

Endpoint

wss://hypercore.goldrushdata.com/ws?key=<GOLDRUSH_API_KEY>
key
string
required
Your GoldRush API key. Passed as a query parameter at connection time - no Authorization header is used.

Subscribe

Send this JSON message after the connection is established:
method
string
required
Always "subscribe".
subscription
object
required

Example

Pick the subscription shape that matches the coverage you want. Every subscription starts with one Snapshot per coin in scope, then per-block Updates carrying only changed levels:
Subscribe withWhat you receive
{"type":"l2BookDiff","coin":"HYPE"}Snapshot + diffs for HYPE only
{"type":"l2BookDiff","coin":["HYPE","BTC","ETH"]}Snapshot + diffs for a fixed list of coins
{"type":"l2BookDiff"}Snapshot + diffs for every perp coin (default: marketTypes: ["perp"])
{"type":"l2BookDiff","marketTypes":["spot"]}Snapshot + diffs for every spot coin
{"type":"l2BookDiff","marketTypes":["outcome"]}Snapshot + diffs for every HIP-4 outcome market
{"type":"l2BookDiff","marketTypes":["perp","spot"]}Snapshot + diffs for perps + spot
{"type":"l2BookDiff","marketTypes":["*"]}Snapshot + diffs for every coin (perp + spot + outcome, plus future types)
wscat -c "wss://hypercore.goldrushdata.com/ws?key=$GOLDRUSH_API_KEY"

> {"method":"subscribe","subscription":{"type":"l2BookDiff","coin":"HYPE"}}

Unsubscribe

Send the same subscription body with method: "unsubscribe":
{
  "method": "unsubscribe",
  "subscription": { "type": "l2BookDiff", "coin": "HYPE" }
}

Streamed messages

Every message has channel: "l2BookDiff". The data payload contains exactly one of two variants: a Snapshot (emitted once per subscribed coin, immediately after subscribe) or an Updates (emitted on each subsequent HyperCore block where the book for at least one subscribed coin changed).

Initial snapshot

After subscribe, the server emits one Snapshot message per coin currently in scope. For a single-coin subscription that is one message; for a list or wildcard subscription that is one message per asset. Each entry in levels[0] (bids) and levels[1] (asks) is an aggregated price level, sorted best-first.
{
  "channel": "l2BookDiff",
  "data": {
    "Snapshot": {
      "coin": "HYPE",
      "time": 1779220051027,
      "block_height": 1002862373,
      "levels": [
        [
          { "px": "48.601", "sz": "51.26", "n": 1 }
        ],
        [
          { "px": "48.614", "sz": "12.34", "n": 1 }
        ]
      ]
    }
  }
}

Incremental updates

Subsequent messages carry only the levels that changed since the previous block, grouped by coin. A level entry with sz: "0" and n: 0 means the level at that price has been removed; any other entry replaces the current state at that px with the new {sz, n}.
{
  "channel": "l2BookDiff",
  "data": {
    "Updates": {
      "time": 1779220051224,
      "block_height": 1002862374,
      "book_diffs": [
        {
          "coin": "HYPE",
          "levels": [
            [
              { "px": "48.601", "sz": "60.00", "n": 2 }
            ],
            [
              { "px": "48.614", "sz": "0", "n": 0 }
            ]
          ]
        }
      ]
    }
  }
}

Response fields

channel
string
Always "l2BookDiff".
data
object
Contains exactly one of Snapshot or Updates.