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

# Orderbook

> Streams book data for given symbol at a set aggregation level as they update

Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.

### Params

```json theme={null}
{
    "method": "subscribe",
    "params": {
        "source": "book",
        "symbol": "SOL",
        "agg_level": 1  // Aggregation level
    }
}
```

where `agg_level`can be one of `1, 10, 100, 1000, 10000`.

### Stream

```json theme={null}
{
  "channel": "book",
  "data": {
    "l": [
      [
        {
          "a": "37.86",
          "n": 4,
          "p": "157.47"
        },
        // ... other aggegated bid levels
      ],
      [
        {
          "a": "12.7",
          "n": 2,
          "p": "157.49"
        },
        {
          "a": "44.45",
          "n": 3,
          "p": "157.5"
        },
        // ... other aggregated ask levels
      ]
    ],
    "s": "SOL",
    "t": 1749051881187,
    "li": 1559885104
  }
}
```

The `book` websocket stream updates once every 250ms

| Field  | Type           | Description                                                                                                                                    |
| ------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `'l'`  | array          | \[Bids, Asks]                                                                                                                                  |
| `'a'`  | decimal string | Total amount in aggregation level.                                                                                                             |
| `'n'`  | integer        | Number of orders in aggregation level.                                                                                                         |
| `'p'`  | decimal string | <ul><li>In bids array, this is highest price in aggregation level.</li><li>In asks array, this is lowest price in aggregation level.</li></ul> |
| `'s'`  | string         | Symbol                                                                                                                                         |
| `'t'`  | number         | Timestamp in milliseconds                                                                                                                      |
| `'li'` | number         | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift.                            |
