Get Coin Exchange Records
Query the coin exchange records.
caution
You may have a long delay of this endpoint.
HTTP Request
GET /private/v1/asset/exchange/list
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
fromCoin | false | string | The currency to convert from. e.g,BTC |
toCoin | false | string | The currency to convert to. e.g,USDT |
limit | false | integer | Limit for data size per page. [1 , 50 ]. Default: 10 |
cursor | false | string | Cursor. Use the nextPageCursor token from the response to retrieve the next page of the result set |
Response Parameters
Parameter | Type | Comments |
---|---|---|
nextPageCursor | string | Refer to the cursor request parameter |
orderBody | array | Object |
> fromCoin | string | The currency to convert from |
> fromAmount | string | The amount to convert from |
> toCoin | string | The currency to convert to |
> toAmount | string | The amount to convert to |
> exchangeRate | string | Exchange rate |
> createdTime | string | Exchange created timestamp (sec) |
> exchangeTxId | string | Exchange transaction ID |
Request Example
import time
import hmac
import hashlib
import requests
import urllib.parse
def create_request(apiKey, secret, params):
url = 'https://openapi-testnet.zoomex.com/private/v1/asset/exchange/list'
timestamp = int(time.time() * 1000)
recv_window = 1000000
params['api_key'] = apiKey
params['timestamp'] = timestamp
params['recv_window'] = recv_window
ordered_params = '&'.join([f"{key}={params[key]}" for key in sorted(params.keys())])
signature = hmac.new(secret.encode('utf-8'), ordered_params.encode('utf-8'), hashlib.sha256).hexdigest()
params['sign'] = signature
headers = {
'X-BAPI-API-KEY': apiKey,
'X-BAPI-SIGN': signature,
'X-BAPI-TIMESTAMP': str(timestamp),
'X-BAPI-RECV-WINDOW': str(recv_window)
}
query_string = urllib.parse.urlencode(params)
full_url = f"{url}?{query_string}"
response = requests.get(full_url, headers=headers)
print("response status:", response.status_code)
print("response info:", response.json())
print("response time:", response.elapsed.total_seconds())
apiKey = 'your key'
secret = 'your secret'
params = {
"fromCoin": "BTC",
"toCoin": "ETH",
}
create_request(apiKey, secret, params)
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"orderBody": [
{
"fromCoin": "BTC",
"fromAmount": "0.100000000000000000",
"toCoin": "ETH",
"toAmount": "1.385866230000000000",
"exchangeRate": "13.858662380000000000",
"createdTime": "1672197760",
"exchangeTxId": "145102533285208544812654440448"
}
],
"nextPageCursor": "173341:1672197760"
},
"retExtInfo": {},
"time": 1672990464021
}