> For the complete documentation index, see [llms.txt](https://docs.infoway.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infoway.io/en-docs/websocket/websocket-subscribe-method/depth-subscription.md).

# Depth Subscription

This WebSocket provides real-time depth data.

### Overview

This WebSocket provides real-time push notifications for **order book (depth)** data. It allows users to access live buy and sell order prices along with their respective volumes for various products.

### **Request Frequency**

For a single WebSocket connection, all requests (subscribe, unsubscribe, heartbeat) are limited to 60 times per minute. If the request frequency limit is exceeded, the connection will be automatically closed. If disconnections occur too frequently, and the system deems them to be malicious requests, the API key will be banned. Please be mindful of the calling logic during usage.

### **Error Code Explanation**

Please refer to the [WebSocket error code](https://docs.infoway.io/en-docs/getting-started/error-codes/websocket-error-codes.md) documentation for further details.

### **Subscription Address**

Please refer to the [WebSocket subscription addresses.](https://docs.infoway.io/en-docs/websocket/subscription-address.md)

### **Request Quantity**

Different subscription plans allow varying numbers of products per WebSocket subscription. Please refer to the [WebSocket restrictions](https://docs.infoway.io/en-docs/getting-started/api-limitation/websocket-limitation.md) documentation for specific details.

### Request (Protocol Number: 10003)

```
{
    "code": 10003,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "data": {
        "codes": "BTCUSDT"
    }
}
```

| Parameter | Type    | Required | Description                                                                   | Example                            |
| --------- | ------- | -------- | ----------------------------------------------------------------------------- | ---------------------------------- |
| `code`    | Integer | Yes      | Request protocol number                                                       | `10003`                            |
| `trace`   | String  | Yes      | Trace ID (random string)                                                      | `423afec425004bd8a5e02e1ba5f9b2b0` |
| `data`    | JSON    | Yes      | Subscription data                                                             |                                    |
| `codes`   | String  | Yes      | Symbol(s) (comma-separated for multiple). India / Japan may use `BSE:INFY.IN` | `BTCUSDT`                          |

### Response (Protocol Number: 10004)

```
{
    "code": 10004,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "msg": "ok"
}
```

| Parameter Name | Type    | Required | Description               | Example Value                      |
| -------------- | ------- | -------- | ------------------------- | ---------------------------------- |
| `code`         | Integer | Yes      | Response protocol number  | `10004`                            |
| `trace`        | String  | Yes      | Trace ID from the request | `423afec425004bd8a5e02e1ba5f9b2b0` |
| `msg`          | String  | Yes      | Response message          | `ok`                               |

### Push (Protocol Number: 10005)

```
{
    "code": 10005,
    "data": {
        "a": [
            [
                "103594.12000000",
                "103594.13000000",
                "103594.38000000",
                "103594.39000000",
                "103594.40000000"
            ],
            [
                "3.50039000",
                "0.00016000",
                "0.00006000",
                "0.00006000",
                "0.00006000"
            ]
        ],
        "b": [
            [
                "103594.11000000",
                "103594.10000000",
                "103594.09000000",
                "103594.08000000",
                "103594.07000000"
            ],
            [
                "3.55117000",
                "0.05942000",
                "0.00006000",
                "0.00006000",
                "0.00006000"
            ]
        ],
        "s": "BTCUSDT",
        "t": 1747553102161
    }
}
```

| Parameter Name | Type       | Required | Description                                           | Example Value                                                                                     |
| -------------- | ---------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `code`         | Integer    | Yes      | Push protocol number                                  | `10005`                                                                                           |
| `data`         | JSON       | Yes      | Push data entity                                      | —                                                                                                 |
| `s`            | String     | Yes      | Symbol name                                           | `BTCUSDT`                                                                                         |
| `t`            | Long       | Yes      | Depth timestamp (in milliseconds)                     | `1747553102161`                                                                                   |
| `a`            | JSON Array | Yes      | Sell side (two arrays: prices and resting quantities) | —                                                                                                 |
| `a[0]`         | JSON Array | Yes      | Sell prices                                           |                                                                                                   |
| `a[1]`         | JSON Array | Yes      | Sell resting quantities                               | `["3.50039000", "0.00016000", "0.00006000", "0.00006000", "0.00006000"]`                          |
| `b`            | JSON Array | Yes      | Buy side (two arrays: prices and resting quantities)  | —                                                                                                 |
| `b[0]`         | JSON Array | Yes      | Buy prices                                            | `["103594.11000000", "103594.10000000", "103594.09000000", "103594.08000000", "103594.07000000"]` |
| `b[1]`         | JSON Array | Yes      | Buy resting quantities                                | `["3.55117000", "0.05942000", "0.00006000", "0.00006000", "0.00006000"]`                          |

Each of `a` and `b` contains two arrays of strings: index `0` holds prices, and index `1` holds the corresponding resting quantities. One level is `[["100.25"],["3"]]`; match entries at the same index for multiple levels. These quantities are resting orders, not executed trade volume.

The subscription request has no optional depth-level parameter. The crypto source supplies up to five levels. Available depth and update timing depend on the market and activity; a successful acknowledgement does not guarantee an immediate snapshot.

For `business=india` / `business=japan`, write the venue in `codes` (India `NSE:INFY.IN`/`BSE:INFY.IN`, Japan `TSE:7203.JP`/`SAPSE:7203.JP`/`NAG:7203.JP`/`FSE:7203.JP`). If omitted, one venue is resolved from the product list and the other venues for that symbol are dropped. An invalid prefix returns `506` with `msg` set to the prefix; an empty prefix or symbol uses `codes`. If any code in this subscribe has a prefix, pushes include `ex`. To receive more than one venue, send prefixed codes. See [Symbol convention](https://docs.infoway.io/en-docs/getting-started/symbol-convention.md). Push field `data.ex` appears when this subscribe included a venue prefix.
