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

# Prices

> Real-time spot asset and instrument price data.

## WebSocket URL Notice

This endpoint currently uses the following WebSocket URL:

```text theme={null}
wss://analytics-ws.amberdata.com/prices
```

This temporary URL applies only to the Prices WebSocket endpoint while we complete internal infrastructure updates for the new Prices WebSocket service. All other WebSocket endpoints will continue to use the existing standard WebSocket URL.

Once this work is complete, the Prices WebSocket endpoint will be migrated to align with our standard WebSocket URL structure. We will provide notice before making any changes that require client-side updates.

## Asset Prices

### Request

All assets:

```json theme={null}
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["prices:spot:asset",{"asset":"all"}]}
```

Specific asset:

```json theme={null}
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["prices:spot:asset",{"asset":"btc"}]}
```

| Param | Type     | Description                                             |
| :---- | :------- | :------------------------------------------------------ |
| asset | `string` | The asset by which to filter. Use `all` for all assets. |

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "subscription": "a3fd4e8d-b344-480f-b1c4-2726c014ae85",
    "result": {
      "asset": "btc",
      "assetArcId": "AMB:BTC000000000",
      "priceUSD": 81650.48236869258,
      "timestamp": 1777995360000,
      "type": "asset",
      "volumeAsset": 74.17509235915826
    }
  }
}
```

| Field       | Type     | Description                                  |
| :---------- | :------- | :------------------------------------------- |
| asset       | `string` | The asset symbol.                            |
| assetArcId  | `string` | The Amberdata ARC ID for the asset.          |
| priceUSD    | `number` | The USD price of the asset.                  |
| timestamp   | `number` | The time at which the price update occurred. |
| type        | `string` | The price update type.                       |
| volumeAsset | `number` | The asset volume.                            |

#### Example

```js theme={null}
const WebSocket = require('ws');

const ws = new WebSocket('wss://analytics-ws.amberdata.com/prices', {
  headers: { 'x-api-key': '<api_key>' }
});

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'subscribe',
    params: ['prices:spot:asset', { asset: 'all' }],
    id: 1
  }));
});

ws.on('message', data => {
  console.log(JSON.stringify(JSON.parse(data), null, 2));
});
```

## Instrument Prices

### Request

All instruments:

```json theme={null}
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["prices:spot:instrument",{"instrument":"all"}]}
```

Specific instrument:

```json theme={null}
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["prices:spot:instrument",{"instrument":"btc_usdt"}]}
```

| Param      | Type     | Description                                                       |
| :--------- | :------- | :---------------------------------------------------------------- |
| instrument | `string` | The instrument by which to filter. Use `all` for all instruments. |

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "subscription": "3276cfc7-0d2d-43bb-8b5a-0ff4f94af296",
    "result": {
      "arcInstrumentId": "AMB:BTC000000000_AMB:USD000000335",
      "instrument": "btc_usdt",
      "priceUSD": 81640.61888782766,
      "timestamp": 1777995360000,
      "type": "instrument",
      "volumeAsset": 28.394765248158286
    }
  }
}
```

| Field           | Type     | Description                                  |
| :-------------- | :------- | :------------------------------------------- |
| arcInstrumentId | `string` | The Amberdata ARC ID for the instrument.     |
| instrument      | `string` | The instrument symbol.                       |
| priceUSD        | `number` | The USD price of the instrument.             |
| timestamp       | `number` | The time at which the price update occurred. |
| type            | `string` | The price update type.                       |
| volumeAsset     | `number` | The asset volume.                            |

#### Example

```js theme={null}
const WebSocket = require('ws');

const ws = new WebSocket('wss://analytics-ws.amberdata.com/prices', {
  headers: { 'x-api-key': '<api_key>' }
});

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'subscribe',
    params: ['prices:spot:instrument', { instrument: 'all' }],
    id: 1
  }));
});

ws.on('message', data => {
  console.log(JSON.stringify(JSON.parse(data), null, 2));
});
```
