Skip to main content

Get Recent Trades

API Description

This interface allow querying the recent trade data for the specified instruments, including trade quantity, trade price, total trade amount, trade time, trade direction, and trade record ID.

Note: Recent trades data is accessible via both RESTful and Websocket APIs. This page describes the RESTful API. For information on the Websocket API, please click here

Precautions

  1. If no timestamp is specified, the interface will return the last 50 trades for the each specified instrument.
  2. If either the starting or ending timestamp is provided, the trade data returned will be limited to a maximum of 50 records.

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 > Spot > RESTful Public Interface.

Request Method

GET

Endpoint

/api/v1/public?command=returnTradeHistory

Frequency Limit

The frequency limit for this interface is 10 requests/s per 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
symbolTrueStringTrading instrument(s). Multiple trading instruments allowed, separated by commas.
Example: "BTC_USDT,ETH_USDT"
Note: Max 20 instruments per request.
startFalseStringStart time: UNIX timestamp
endFalseStringEnd time: UNIX timestamp

Response Parameters

ParameterTypeDescription
idStringTrade record ID.
typeStringTrade direction:Buy/Sell
priceStringPrice in quote currency
amountStringTrade size in base currency
totalStringTrade size in quote currency
timeStringTrade time (timestamp)
pairStringtrading instrument

Request Example

The following Python code shows how to get the trade data for BTC_USDT and ETH_USDT.

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

api_url= "/api/v1/public?command=returnTradeHistory"
params={
"symbol": "BTC_USDT,ETH_USDT",
# "start": "1579238517000",
# "end": "1581916917660",
}
SpotRestfulPublic(api_url, params)  # function SpotRestfulPublic() is defined in section (Introduction > Authentication & Code Snippet > Spot > RESTful Public Interface)

Note: For complete Java code navigate to Introduction > Authentication & Code Snippet > Spot > RESTful Public Interface.

Response Example

The following is an example response returned by the above Python request. The actual response includes data for the 50 most recent trades for each instrument. For brevity, below displays only four trades per instrument:

{'code': '200',
'data': [{'id': 142912092, ## BTC_USDT
'type': 'SELL',
'price': '87468.02',
'amount': '0.0007',
'total': '61.227614',
'time': '2025-11-25 21:01:25',
'pair': 'BTC_USDT'},
{'id': 142912091,
'type': 'SELL',
'price': '87468.12',
'amount': '0.0009',
'total': '78.721308',
'time': '2025-11-25 21:01:24',
'pair': 'BTC_USDT'},
{'id': 142912090,
'type': 'BUY',
'price': '87467.74',
'amount': '0.8241',
'total': '72082.164534',
'time': '2025-11-25 21:01:23',
'pair': 'BTC_USDT'},,........
{'id': 142912043,
'type': 'SELL',
'price': '87499.97',
'amount': '0.0011',
'total': '96.249967',
'time': '2025-11-25 20:59:38',
'pair': 'BTC_USDT'},
{'id': 67594437, # ETH_USDT
'type': 'SELL',
'price': '2925.75',
'amount': '0.2533',
'total': '741.092475',
'time': '2025-11-25 21:01:19',
'pair': 'ETH_USDT'},
{'id': 67594436,
'type': 'SELL',
'price': '2925.7',
'amount': '0.146',
'total': '427.1522',
'time': '2025-11-25 21:01:18',
'pair': 'ETH_USDT'},
{'id': 67594435,
'type': 'SELL',
'price': '2925.55',
'amount': '0.1274',
'total': '372.71507',
'time': '2025-11-25 21:01:13',
'pair': 'ETH_USDT'},.......
{'id': 67594388,
'type': 'SELL',
'price': '2927.51',
'amount': '0.1521',
'total': '445.274271',
'time': '2025-11-25 20:59:16',
'pair': 'ETH_USDT'}],
'msg': 'SUCCESS',
'success': True,
'failed': False}