> For the complete documentation index, see [llms.txt](https://docs.hydromancer.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hydromancer.xyz/readme/websocket/prices-data-and-asset-context/allperpprices.md). Agents can also search and read this documentation through its [MCP server](https://docs.hydromancer.xyz/~gitbook/mcp).

# allPerpPrices

Stream every accepted perp oracle and mark price, one message per block, optionally filtered by DEX. Requires add-on permission.

Every live data message includes both routing identifiers with the same value:

```json
{"type": "allPerpPrices", "channel": "allPerpPrices"}
```

Other payload fields are omitted above. Existing clients may continue routing on either field.

{% hint style="info" %}
💧 New endpoint - this endpoint is not a part of original Hyperliquid API and is added by us for builder convenience.
{% endhint %}

{% hint style="warning" %}

### ⚠️ This is an add-on endpoint - access has to be purchased separately.

{% endhint %}

The all-coins form of [perpPrices](https://docs.hydromancer.xyz/readme/websocket/prices-data-and-asset-context/perpprices.md): the prices the exchange actually uses for margining and liquidation, for every perp on every DEX (including HIP-3), without listing coins. A row here is identical to the row [perpPriceHistoryByTime](https://docs.hydromancer.xyz/readme/rest-api/asset-data/perppricehistorybytime.md) returns for the same block. New listings appear without any change to the subscription.

### Subscribe

```json
{
    "method": "subscribe",
    "subscription": {
        "type": "allPerpPrices"
    }
}
```

To receive only some DEXes, pass `dex` as a single name or a list. `"main"` is the native DEX (`"hyperliquid"` is accepted as an alias):

```json
{
    "method": "subscribe",
    "subscription": {
        "type": "allPerpPrices",
        "dex": ["main", "xyz"]
    }
}
```

**Parameters:**

| Parameter | Type                | Required | Description                                                                                     |
| --------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------- |
| `dex`     | string or string\[] | No       | DEXes to receive, up to 32. Omit to receive every DEX. `"main"` matches coins without a prefix. |

DEX filters work like [allActiveAssetCtx](https://docs.hydromancer.xyz/readme/websocket/prices-data-and-asset-context/allactiveassetctx.md):

* A connection holds one `allPerpPrices` subscription. Subscribing again **merges** the new `dex` filters into it; the confirmation echoes the merged set.
* Subscribing without `dex` switches the subscription to every DEX, absorbing any active filters (the confirmation carries a `dex_filters_absorbed` warning).
* Subscribing to a DEX that is already covered is accepted as a no-op with a `redundant_dex` warning. An unrecognized DEX succeeds with an `unknown_dex` warning and starts matching if that DEX deploys later.
* The merged set is capped at **32 DEXes**; a subscribe past the cap is rejected with an error.

### Unsubscribe

```json
{
    "method": "unsubscribe",
    "subscription": {
        "type": "allPerpPrices",
        "dex": ["xyz"] // optional; removes just these DEXes
    }
}
```

Unsubscribing with `dex` removes those DEXes; the subscription ends when the last one is removed. Unsubscribing without `dex` always removes the whole subscription. A dex-scoped unsubscribe is rejected with an `error` while the every-DEX form is active: unsubscribe fully, then resubscribe with an explicit list.

### Update data format

**A message is sent for every block** (\~70 ms), in block order, including blocks that carry no price round for your DEXes. `prices` is then `[]`. That lets you track the chain height and time continuously. Each DEX publishes a round roughly every 3 seconds, so with every DEX subscribed about one message in nine carries rows.

```json
{
    "type": "allPerpPrices",
    "channel": "allPerpPrices",
    "seq": 42,
    "cursor": "1131737186:1788273972577",
    "data": {
        "height": 1131737186,
        "timestamp": 1788273972577,
        "prices": [
            {
                "time": 1788273972577,
                "blockNumber": 1131737186,
                "dex": "hyperliquid",
                "coin": "BTC",
                "oraclePx": "78356.00",
                "markPx": "78340.00",
                "extPerpPx": "78314.65"
            },
            {
                "time": 1788273972577,
                "blockNumber": 1131737186,
                "dex": "xyz",
                "coin": "xyz:GOLD",
                "oraclePx": "106.88",
                "markPx": "106.97",
                "updateClass": "Normal"
            }
        ]
    }
}
```

`data` has the same fields as [perpPrices](https://docs.hydromancer.xyz/readme/websocket/prices-data-and-asset-context/perpprices.md#update-data-format); see that page for each field. One block's message carries all its rows, a few hundred at most (well under 100 KB), so it is never split into chunks.

### Reconnecting

Subscribe with the `cursor` of the last message you processed to resume. The server first sends a `replay` message (`"channel": "allPerpPrices"`) whose `data` is a list of the missed blocks' `data` objects, narrowed to your DEXes, then the live messages continue. Replay includes **every** missed block, with `prices: []` for blocks that carried no round for your DEXes, so `height` goes up by exactly 1 from your cursor through the replay and on into the live messages. Replay covers at least the last 4 minutes. An older cursor gets the retained blocks with `hasGap: true`; fetch the rest from [perpPriceHistoryByTime](https://docs.hydromancer.xyz/readme/rest-api/asset-data/perppricehistorybytime.md).

```json
{
    "method": "subscribe",
    "subscription": {
        "type": "allPerpPrices",
        "dex": ["xyz"],
        "cursor": "1131737186:1788273972577"
    }
}
```

### Access

Each `ws:allPerpPrices` add-on grant allows one `allPerpPrices` subscription; grants stack across the API key's connections. A key without the add-on gets an `error` naming `ws:allPerpPrices`.
