# GET Market Depth

### Overview

The **Market Depth API** provides the latest buy and sell order information (market depth) for various financial instructments, including stocks, cryptocurrencies, forex, energy, commodities, and more. This API allows users to retrieve live buy and sell orders for a specified list of symbols.

### Endpoint

<table><thead><tr><th width="179.77777099609375">Market</th><th>Endpoint</th></tr></thead><tbody><tr><td>Stocks</td><td><code>https://data.infoway.io/stock/batch_depth/{codes}</code></td></tr><tr><td>Crypto</td><td><code>https://data.infoway.io/crypto/batch_depth/{codes}</code></td></tr><tr><td>Forex, Commodities, Futures</td><td><code>https://data.infoway.io/common/batch_depth/{codes}</code></td></tr></tbody></table>

### Request Frequency

This API shares the same rate limits as other endpoints. The number of allowed requests per second depends on your subscription plan. Please refer to the [**Rate Limit Policy**](https://docs.infoway.io/en-docs/getting-started/api-limitation/rest-api-limitation) for details.

### Error Codes

See the [HTTP Error Codes](https://docs.infoway.io/en-docs/getting-started/error-codes/rest-api-error-codes) section for reference.

### Authentication

Each request must include your **API Key** in the header.

| **Header** | **Type** | **Required** | **Description**                                 |
| ---------- | -------- | ------------ | ----------------------------------------------- |
| `apiKey`   | String   | Yes          | Your API Key associated with your current plan. |

### Request Parameters

| **Parameter** | **Type** | **Required** | **Description**                                                           | **Example**       |
| ------------- | -------- | ------------ | ------------------------------------------------------------------------- | ----------------- |
| `codes`       | String   | Yes          | Comma-separated list of product codes to query.(Up to 100 symbol at once) | `TSLA.US,AAPL.US` |

### Example Response

```json
{
  "ret": 200,
  "msg": "success",
  "traceId": "972c7bdd-a151-4a13-b4a1-a24a30c65783",
  "data": [
    {
      "s": "00285.HK",
      "t": 1747382976831,
      "a": [
        ["34.650","34.700","34.750","34.800","34.850","34.900","34.950","35.000","35.050","35.100"],
        ["44000","44500","225500","124000","147500","135500","65000","111000","39500","124500"]
      ],
      "b": [
        ["34.600","34.550","34.500","34.450","34.400","34.350","34.300","34.250","34.200","34.150"],
        ["109500","39500","130500","89000","144000","246500","231500","83000","224000","22000"]
      ]
    },
    {
      "s": "002594.SZ",
      "t": 1747378802012,
      "a": [
        ["389.17","389.45","389.50","389.57","389.69"],
        ["60","6","1","1","8"]
      ],
      "b": [
        ["389.16","389.09","389.05","389.02","389.01"],
        ["6","1","1","1","10"]
      ]
    }
  ]
}
```

### Response Fields

| **Field** | **Type** | **Required** | **Description**                                                                                                                       | **Example / Values**                  |
| --------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| `s`       | String   | Yes          | The product code or symbol.                                                                                                           | `00285.HK`                            |
| `t`       | Long     | Yes          | The trade timestamp in Unix epoch format (milliseconds).                                                                              | `1747382898892`                       |
| `a`       | Array    | Yes          | The sell orders array, with the first sub-array representing prices and the second representing volumes (number of shares/contracts). | `[[34.650, 34.700], [44000, 44500]]`  |
| `b`       | Array    | Yes          | The buy orders array, with the first sub-array representing prices and the second representing volumes (number of shares/contracts).  | `[[34.600, 34.550], [109500, 39500]]` |

### Notes

* The `a` field represents the buy orders and contains two sub-arrays: the first for prices and the second for volumes.
* The `b` field represents the sell orders, with the same structure as the buy orders.
* This API is useful for tracking real-time market depth to make informed trading decisions.
