Get Historical Public Trades
API Description
This endpoint allows querying the history of public trades for the specified trading instrumnet.
Note: Historical Public Trades data is only available via RESTful API.
Precautions
- This endpoint provides public market information and requires authentication.
Authentication
This is a public interface, authentication is still required to access it. For details on using the RESTful API, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Request Method
GET
Endpoint
Frequency limit
The frequency limit for this interface is 5 requests/s 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 |
|---|---|---|---|
| instrument | True | String | The base currency of the instrument. (e.g., BTC or btc). This parameter is case-insensitive. Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid. |
| page | False | Integer | Current Page |
| pageSize | False | Integer | Current page number Note: 1. By default returns 100 trades. 2. Maximum number of trades returned can be at most 500. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| closedPiece | integer | Number of closed contracts |
| createdDate | long | Transaction time (timestamp) |
| dealPrice | BigDecimal | Transaction price in quote currency i.e usdt |
| direction | string | Trade direction (long, short) |
| id | long | Transaction ID |
Request Example
The following Python code shows how to get hirtorical public trades for "BTC".
Note: For a complete code example, please refer to General Information > Authentication and Code Snippet > Futures > Restful Private Interface.
api_url = "/v1/perpum/orders/trades"
method = "GET"
params = { "instrument" : "BTC",
# "page" :
"pageSize" : 5,
}
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)
Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Response Example
Following is the response returned the above Python request:
{'code': 0,
'data': {'nextId': 0,
'prevId': 0,
'rows': [{'closedPiece': 0,
'createdDate': 1745221207000,
'dealPrice': 0,
'direction': 'short',
'id': 21375851492523014},
{'closedPiece': 0,
'createdDate': 1745221207000,
'dealPrice': 87479.8,
'direction': 'long',
'id': 21375851492523013},
{'closedPiece': 0,
'createdDate': 1745221206000,
'dealPrice': 87479.8,
'direction': 'long',
'id': 21375851481381894},
{'closedPiece': 0,
'createdDate': 1745221206000,
'dealPrice': 0,
'direction': 'short',
'id': 21375851481381893},
{'closedPiece': 0,
'createdDate': 1745221206000,
'dealPrice': 87479.8,
'direction': 'long',
'id': 21375851453594630}],
'total': 2883165},
'msg': ''}