# RPI Depth Channel

### Description

Push [RPI (Retail Price Improvement)](https://www.bitget.com/support/articles/12560603867770#:~:text=RPI) depth data. `rpi-books` is the full depth channel, `rpi-books1` is the 1-level channel, `rpi-books5` is the 5-level channel, and `rpi-books50` is the 50-level channel:

- `rpi-books` corresponds to full-depth data, the first push is the full data `snapshot`, subsequent pushes are incremental updates: `update`
- `rpi-books1` corresponds to 1-level depth data, every push: `snapshot`
- `rpi-books5` corresponds to 5-level depth data, every push: `snapshot`
- `rpi-books50` corresponds to 50-level depth data, every push: `snapshot`


- `rpi-books1` push frequency: 10ms 
- `rpi-books5` push frequency: 100ms
- `rpi-books50` push frequency: 100ms
- `rpi-books` push frequency: 100ms


**Sequence Number (seq)**

- The standard orderbook and the RPI orderbook maintain independent seq rules, each calculated separately.

<div className="api-aligning">

```json title="Request Example"
{
    "op": "subscribe",
    "args": [
        {
            "instType": "usdt-futures",
            "topic": "rpi-books5",
            "symbol": "BTCUSDT"
        }
    ]
}
```

### Request Parameters

| Parameters    | Type               | Required | Description                                                                                                                                |
|---------------|--------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------|
| op            | String             | Yes      | Operation <br/> `subscribe` Subscribe <br/> `unsubscribe` Unsubscribe                                                                      |
| args          | List&lt;Object&gt; | Yes      | Subscribed channel                                                                                                                         |
| &gt; instType | String             | Yes      | Product type<br/>`spot` Spot trading<br/>`usdt-futures` USDT futures <br/> `coin-futures` Coin-M futures <br/> `usdc-futures` USDC futures |
| &gt; topic    | String             | Yes      | Topic <br/> `rpi-books` All levels <br/> `rpi-books1` 1 level <br/> `rpi-books5` 5 levels <br/> `rpi-books50` 50 levels                    |
| &gt; [symbol](/docs/catalog/market/market-data#get-instruments)   | String             | Yes      | Symbol name <br/> e.g., `BTCUSDT`                                                                                                          |

</div>

<div className="api-br-10"></div>

<div className="api-aligning">

```json title="Response Example"
{
  "event": "subscribe",
  "arg": {
    "instType": "usdt-futures",
    "topic": "rpi-books5",
    "symbol": "BTCUSDT"
  },
  "connId": "xxxxxxxxxx"
}
```

### Response Parameters

| Parameters      | Type   | Description                                                                                                                                |
|-----------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------|
| event           | String | Event                                                                                                                                      |
| arg             | Object | Subscribed channel                                                                                                                         |
| &gt; instType   | String | Product type<br/>`spot` Spot trading<br/>`usdt-futures` USDT futures <br/> `coin-futures` Coin-M futures <br/> `usdc-futures` USDC futures |
| &gt; topic      | String | Topic                                                                                                                                      |
| &gt; symbol     | String | Symbol name                                                                                                                                |
| code            | String | Error code                                                                                                                                 |
| msg             | String | Error message                                                                                                                              |
| connId          | String | Connection ID                                                                                                                              |

</div>

<div className="api-br-5"></div>


<div className="api-aligning">

```json title="Push Data"
{
  "data": [
    {
      "a": [
        [
          "3366.8",
          "9",
          "1"
        ],
        [
          "3367",
          "0",
          "1"
        ],
        [
          "3368",
          "8",
          "2"
        ]
      ],
      "b": [
        [
          "3366.1",
          "7",
          "1"
        ],
        [
          "3366",
          "6",
          "1"
        ]
      ],
      "pseq": 0,
      "seq": 1304314508780744705,
      "ts": "1730969017964"
    }
  ],
  "arg": {
    "instType": "usdt-futures",
    "symbol": "BTCUSDT",
    "topic": "rpi-books5"
  },
  "action": "snapshot",
  "ts": 1730969017965
}
```

### Push Parameters

| Return Field       | Parameter Type     | Description                                                                                                                                               |
|--------------------|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| arg                | Object             | Subscribed channel                                                                                                                                        |
| &gt; instType      | String             | Product type<br/>`spot` Spot trading<br/>`usdt-futures` USDT futures <br/> `coin-futures` Coin-M futures <br/> `usdc-futures` USDC futures                |
| &gt; topic         | String             | Topic                                                                                                                                                     |
| &gt; symbol        | String             | Symbol name                                                                                                                                               |
| action             | String             | Data push action <br/> `snapshot` Full push <br/> `update` Incremental push                                                                               |
| ts                 | String             | Data push timestamp                                                                                                                                       |
| data               | List&lt;Object&gt; | Subscribed data                                                                                                                                           |
| &gt; a             | List&lt;String&gt; | Sell Asks. Sort by price in ascending order                                                                                                               |
| &gt; &gt; a[0]     | String             | Ask price                                                                                                                                                 |
| &gt; &gt; a[1]     | String             | Ask non-RPI quantity                                                                                                                                      |
| &gt; &gt; a[2]     | String             | Ask RPI quantity                                                                                                                                          |
| &gt; b             | List&lt;String&gt; | Buy bids. Sort by price in descending order                                                                                                               |
| &gt; &gt; b[0]     | String             | Bid price                                                                                                                                                 |
| &gt; &gt; b[1]     | String             | Bid non-RPI quantity                                                                                                                                      |
| &gt; &gt; b[2]     | String             | Bid RPI quantity                                                                                                                                          |
| &gt; &gt; seq      | String             | Serial number.<br/> It increments when the order book is updated and can be used to determine whether there are out-of-order packets.                     |
| &gt; &gt; pseq     | String             | The serial number of the previous push. <br/> Can be used to determine if there has been packet loss.  This field only has a value for the rpi-books channel. |
| &gt; &gt; ts       | String             | The timestamp that the system generated data <br/>A Unix timestamp in milliseconds                                                                        |

</div>