Get Trade Data of an Instrument
API Description
This endpoint allows querying the trade data for a specified instrument, including contract size, direction, ID, timestamp, and price. By default, it will return data for the 20 most recent trades.
Note: Trade data is available via both Resful and Websocket APIs. This page describes the RESTful API. For information on the Websocket API, please click here
Precautions
- This interface does not allow users to specify the number of trades to return. By default, it will return the 20 most recent trades.
- This interface does not support specifying a time range for querying trade data in specified time interval.
Authentication
This is a public interface and does not require authentication. For details on using the RESTful API, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Public Interface.
Request Method
GET
Endpoint
Frequency Limit
The frequency limit for this interface is 10 requests/2s per user ID and IP. In addition to this per-interface limit, a global rate limit is also enforced.
For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| base | true | String | Note: for USDT contracts, pass only the base currency name, for example BTCUSDT can use BTC; for USDC contracts, pass the full trading pair, for example BTC_USDC. This parameter is case-insensitive.Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| createdDate | Long | The timestamp when the trade occurred |
| piece | String | Number of contracts |
| direction | String | Trade direction: long, short. |
| price | String | The executed transaction price |
| quantity | String | Transaction volume (number of coins) |
| id | Long | Primary key ID |
Request Example
The following Python code shows how to get the trade data for BTC.
Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Public Interface.
api_url = "/v1/perpumPublic/trades"
params = {"base": "BTC", }
FuturesRestfulPublic(api_url, params) # function FuturesRestfulPublic() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Public Interface)
Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Public Interface.