# Get The Last Trade of a Contract

#### /sapi/v1/market/trade&#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. business\_type is a required parameter when query info of futures contract, and its value must be futures or all.

### 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    | false    | contract code or contract type, swap: "BTC-USDT"... , future: "BTC-USDT-210625" ... or BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ |             |               |
| business\_type | string    | false    | business type, default is swap: futures, swap, all                                                                                        |             |               |

### Response Parameter

| Parameter        | Data Type | Required | Description                                                                     | Value Range                                                                                               |
| ---------------- | --------- | -------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| ch               | string    | true     | Data belonged channel，Format： market.$contract\_code.trade.detail               |                                                                                                           |
| status           | string    | true     |                                                                                 | "ok","error"                                                                                              |
| ts               | long      | true     | Sending time                                                                    |                                                                                                           |
| \<tick>          |           | false    |                                                                                 |                                                                                                           |
| id               | long      | true     | Unique Order Id(symbol level).                                                  |                                                                                                           |
| ts               | long      | true     | Latest Creation Time                                                            |                                                                                                           |
| \<data>          |           | false    |                                                                                 |                                                                                                           |
| id               | long      | true     | Unique Transaction Id(symbol level)                                             |                                                                                                           |
| price            | string    | true     | Price                                                                           |                                                                                                           |
| amount           | string    | true     | Quantity(Cont.). Sum of both buy and sell sides                                 |                                                                                                           |
| direction        | string    | true     | The direction to buy or sell is the direction of the taker (active transaction) |                                                                                                           |
| ts               | long      | true     | Order Creation Time                                                             |                                                                                                           |
| quantity         | string    | true     | trading quantity(coin)                                                          |                                                                                                           |
| contract\_code   | string    | true     | Contract Code or Contract type                                                  | swap: "BTC-USDT"... , future: "BTC-USDT-210625" ... or BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ |
| business\_type   | string    | true     | business type                                                                   | futures, swap                                                                                             |
| trade\_turnover  | string    | true     | trade turnover(quoted currency)                                                 |                                                                                                           |
| trade\_partition | string    | true     | Deprecated parameter                                                            |                                                                                                           |
| \</data>         |           | false    |                                                                                 |                                                                                                           |
| \</tick>         |           | false    |                                                                                 |                                                                                                           |

### Request Example

```
GET https://api.sunx.io/sapi/v1/market/trade
```

### Response Example

```
{
    "ch": "market.BTC-USDT.trade.detail",
    "status": "ok",
    "tick": {
        "data": [
            {
                "amount": "2",
                "quantity": "0.002",
                "trade_turnover": "231.1328",
                "ts": 1758015518607,
                "id": 1000000192444090000,
                "price": "115566.4",
                "direction": "sell",
                "contract_code": "BTC-USDT",
                "business_type": "swap",
                "trade_partition": "USDT"
            }
        ],
        "id": 1758016716711,
        "ts": 1758016716711
    },
    "ts": 1758016716711
}
```
