> ## Documentation Index
> Fetch the complete documentation index at: https://docs.predexon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Crypto Prices

> Real-time crypto price ticks relayed from Chainlink Data Streams

The crypto-prices channel streams real-time price ticks from [Chainlink Data Streams](https://docs.chain.link/data-streams) (Mercury). One tick per upstream observation - no batching, no aggregation. Use this for charting, signals, or as a price reference alongside the on-chain Polymarket channels.

<Note>
  This is the only channel that uses `platform: "chainlink"`. All other channels use `platform: "polymarket"`.
</Note>

## Subscribe

```json theme={null}
{
  "action": "subscribe",
  "platform": "chainlink",
  "version": 1,
  "type": "crypto",
  "filters": { "feeds": ["BTC/USD", "ETH/USD"] }
}
```

### Filter Types

| Filter           | Description              | Example                  |
| ---------------- | ------------------------ | ------------------------ |
| `feeds`          | One or more feed symbols | `["BTC/USD", "SOL/USD"]` |
| Wildcard `["*"]` | All entitled feeds       | `{"feeds": ["*"]}`       |

<Note>
  `users`, `token_ids`, `condition_ids`, and `market_slugs` are **not supported** - crypto prices aren't tied to wallets or markets. Subscribing with any of those returns `INVALID_FILTERS`.
</Note>

### Supported Feeds

| Symbol     | Asset       |
| ---------- | ----------- |
| `BTC/USD`  | Bitcoin     |
| `ETH/USD`  | Ethereum    |
| `SOL/USD`  | Solana      |
| `XRP/USD`  | XRP         |
| `BNB/USD`  | BNB         |
| `DOGE/USD` | Dogecoin    |
| `HYPE/USD` | Hyperliquid |

***

## Event Type

### price\_feed

A single price tick from one of the subscribed feeds.

```json theme={null}
{
  "type": "event",
  "subscription_id": "sub_xxx",
  "data": {
    "event_type": "price_feed",
    "feed": "BTC/USD",
    "price": 66225.49,
    "bid": 66221.69,
    "ask": 66229.46,
    "observed_at": 1774672588,
    "timestamp": 1774672588
  }
}
```

***

## Field Reference

| Field         | Type           | Description                                   |
| ------------- | -------------- | --------------------------------------------- |
| `event_type`  | `"price_feed"` | Always `price_feed`                           |
| `feed`        | string         | Feed symbol (e.g. `"BTC/USD"`)                |
| `price`       | number         | Mid / benchmark price reported by Chainlink   |
| `bid`         | number         | Bid price                                     |
| `ask`         | number         | Ask price                                     |
| `observed_at` | number         | Upstream observation timestamp (Unix seconds) |
| `timestamp`   | number         | Same as `observed_at`                         |

<Note>
  Chainlink reports prices as 1e18 fixed-point integers; Predexon converts to floating-point with 8 decimal places of precision before publishing.
</Note>

***

## Example: Track Multiple Feeds

```javascript theme={null}
ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  if (msg.type === 'event' && msg.data.event_type === 'price_feed') {
    const { feed, price, bid, ask, observed_at } = msg.data;
    const spread = ask - bid;
    console.log(`[${feed}] $${price.toFixed(2)}  bid=${bid.toFixed(2)} ask=${ask.toFixed(2)} spread=${spread.toFixed(4)}`);
  }
};

ws.send(JSON.stringify({
  action: 'subscribe',
  platform: 'chainlink',
  version: 1,
  type: 'crypto',
  filters: { feeds: ['BTC/USD', 'ETH/USD', 'SOL/USD'] }
}));
```
