Skip to main content

Get Historical Orders

API Description

This interface allows users to retrieve historical orders across all instruments. It supports optional filtering by a specific instrument and returns up to 100 records per request. Users can further refine the results using time-based filters or pagination for efficient data retrieval.

Note: Historical Orders data is only available via RESTful API.

Precautions

  1. A maximum of 100 records is returned per request.
  2. The "orderType" will be returned as "LIMIT" for market orders.
  3. Orders which did not commence trading will not show up in this interface. Only orders that have been completed will be returned.

Authentication

This is a private interface and requires authentication. For details on using the RESTful API, refer to General Information > Authentication and Code Snippet > Spot > RESTful Private Interface.

Request Method

POST

Endpoint

/api/v1/private?command=getUserTrades

Frequency Limit

The frequency limit for this interface is 10 requests/2s per user ID. 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
symbolFalseStringTrading instrument, i.e., BTC_USDT
startAtFalseLongStart time (timestamp)
endAtFalseLongEnd time (timestamp)
limitFalseIntegerQuery number: The value of limit ranges from 0 to 100
beforeFalseStringPagination parameter for previous page (if any)
afterFalseStringPagination parameter for next page (if any)

Response Parameters

ParameterTypeDescription
tradeIdLongTrade ID
orderIdLongOrder ID
pricestringOrder price in quote currency
sizeStringOrder size in base currency
sideStringTrade direction: Buy/Sell
orderTypeStringOrder type:Limit
timeLongTransaction time (timestamp)
feeStringHandling fee
beforeLongPagination parameter for previous page (if any)
afterLongPagination parameter for next page (if any)

Request Example

The following Python code shows how to get users historical orders for BTC_USDT.

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface.

api_url = "/api/v1/private?command=getUserTrades"
method = "post"
params = {"symbol": "BTC_USDT",
# "startAt":"1631526172583",
# "endAt":"1631526317779",
}
SpotRestfulPrivate(host, api_url, method, api_key, params, secret_key) # function SpotRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface.

Response Example

The following is an example response returned by the above Python request. For brevity, only one order data is shown below**:**

{'code': '200',
'data': {'list': [{'orderType': 'LIMIT',
'orderId': 4624385377802383167,
'fee': '0E-18',
'price': '82429.080000000000000000',
'size': '0.001200000000000000',
'side': 'BUY',
'time': 1741772251663,
'tradeId': 127204554},.......]},
'msg': 'SUCCESS',
'success': True,
'failed': False}