Skip to main content

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

  1. 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

/v1/perpum/orders/trades

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

ParametermandatoryTypeDescription
instrumentTrueStringThe 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.
pageFalseIntegerCurrent Page
pageSizeFalseIntegerCurrent page number
Note:
1. By default returns 100 trades.
2. Maximum number of trades returned can be at most 500.

Response Parameters

ParameterTypeDescription
closedPieceintegerNumber of closed contracts
createdDatelongTransaction time (timestamp)
dealPriceBigDecimalTransaction price in quote currency i.e usdt
directionstringTrade direction (long, short)
idlongTransaction 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': ''}