# Get Market Depth

#### /sapi/v1/market/depth&#x20;

Request type: GET

Signature verification: No

Interface permission: Read

Rate Limit: For public interface to get market data such as Get Kline data, Get Market Data Overview, Get Contract Information,Get market in-depth data, Get premium index Kline, Get real-time forecast capital rate kline, Get basis data, Get the last Trade of a Contract and so on： （1）For restful interfaces, products, (future, coin margined swap, usdt margined Contracts)800 times/second for one IP at most

Interface description: The interface supports cross margin mode and isolated margin mode. The request parameter "contract\_code" supports the contract code of futures, in that the format is BTC-USDT-210625; and supports contract type: BTC-USDT, BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ.

### Request Address

| Environment                         | Address                                     |
| ----------------------------------- | ------------------------------------------- |
| Online                              | [https://api.sunx.io](https://api.sunx.io/) |
| Online (preferred by aws customers) | [https://api.sunx.io](https://api.sunx.io/) |

### Request Parameter

| Parameter      | Data Type | Required | Description                                                                                                                                                                                                                                                                                                                                                                         | Value Range | Default Value |
| -------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------- |
| contract\_code | string    | true     | swap: "BTC-USDT"... , future: "BTC-USDT-220325" ... or BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ                                                                                                                                                                                                                                                                           |             |               |
| type           | string    | true     | Get depth data within step 150, use step0, step1, step2, step3, step4, step5, step14, step15, step16, step17（merged depth data 0-5,14-17）；when step is 0，depth data will not be merged; Get depth data within step 30, use step6, step7, step8, step9, step10, step11, step12, step13, step18, step19(merged depth data 7-13,18-19); when step is 6, depth data will not be merged. |             |               |

Notes: \
step16, step17, step18, and step19 are only for SHIB-USDT contract, and the other contracts is not supported now.

### Response Parameter

| Parameter | Data Type    | Required | Description                                                                     | Value Range    |
| --------- | ------------ | -------- | ------------------------------------------------------------------------------- | -------------- |
| ch        | string       | true     | Data belonged channel，Format： market.period                                     |                |
| status    | string       | true     | Request Processing Result                                                       |                |
| ts        | long         | true     | Time of Respond Generation，Unit：Millisecond                                     | "ok" , "error" |
| \<tick>   | object array | false    |                                                                                 |                |
| mrid      | long         | true     | Order ID                                                                        |                |
| id        | long         | true     | tick ID                                                                         |                |
| asks      | object       | false    | Sell,\[price(Ask price), vol(Ask orders (cont.) )], price in ascending sequence |                |
| bids      | object       | false    | Buy,\[price(Bid price), vol(Bid orders(Cont.))], Price in descending sequence   |                |
| ts        | long         | true     | Time of Respond Generation, Unit: Millisecond                                   |                |
| version   | long         | true     | version ID                                                                      |                |
| ch        | string       | true     | Data channel, Format： market.period                                             |                |
| \</tick>  |              | false    |                                                                                 |                |

### Request Example

```
GET https://api.sunx.io/sapi/v1/market/depth?contract_code=BTC-USDT&type=step0
```

### Response Example

```
{
    "ch": "market.BTC-USDT.depth.step0",
    "status": "ok",
    "tick": {
        "mrid": 100000019245599,
        "id": 1758016468,
        "bids": [
            [
                115507.7,
                41
            ],
            [
                115426.9,
                4
            ],
            [
                115411.9,
                4
            ],
            [
                115396.9,
                4
            ],
            [
                115381.9,
                4
            ],
            [
                115366.9,
                4
            ],
            [
                115351.9,
                5
            ],
            [
                115336.9,
                4
            ],
            [
                115321.9,
                4
            ],
            [
                115306.9,
                4
            ],
            [
                115291.9,
                4
            ]
        ],
        "asks": [
            [
                115580.2,
                4
            ],
            [
                115583.2,
                41
            ],
            [
                115595.2,
                4
            ],
            [
                115610.2,
                4
            ],
            [
                115625.2,
                4
            ],
            [
                115640.2,
                5
            ],
            [
                115655.2,
                5
            ],
            [
                115670.2,
                5
            ],
            [
                115685.2,
                5
            ],
            [
                115700.2,
                5
            ],
            [
                115715.2,
                5
            ]
        ],
        "ts": 1758016468240,
        "version": 1758016468,
        "ch": "market.BTC-USDT.depth.step0"
    },
    "ts": 1758016470037
}
```
