# Depth Subscription

### 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](/en-docs/getting-started/error-codes/websocket-error-codes.md) documentation for further details.

### **Subscription Address**

Please refer to the [WebSocket subscription addresses.](/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](/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) | `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: price and volume arrays) | —                                                                                                 |
| `a[0]`         | JSON Array | Yes      | Sell prices                                     |                                                                                                   |
| `a[1]`         | JSON Array | Yes      | Sell volumes                                    | `["3.50039000", "0.00016000", "0.00006000", "0.00006000", "0.00006000"]`                          |
| `b`            | JSON Array | Yes      | Buy side (two arrays: price and volume arrays)  | —                                                                                                 |
| `b[0]`         | JSON Array | Yes      | Buy prices                                      | `["103594.11000000", "103594.10000000", "103594.09000000", "103594.08000000", "103594.07000000"]` |
| `b[1]`         | JSON Array | Yes      | Buy volumes                                     | `["3.55117000", "0.05942000", "0.00006000", "0.00006000", "0.00006000"]`                          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.infoway.io/en-docs/websocket/websocket-subscribe-method/depth-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
