Get Spot/Fund Asset Info
Query asset information
tip
- Due to historical reasons, this interface uses v1 authentication method
HTTP Request
GET /cloud/trade/v3/asset/transfer/query-asset-info
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| accountType | true | string | Account type:SPOT or FUND, default SPOT |
| coin | false | string | Coin name |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| spot | Object | |
| > status | string | account status. ACCOUNT_STATUS_NORMAL: normal, ACCOUNT_STATUS_UNSPECIFIED: banned |
| > assets | array | Object |
| >> coin | string | Coin |
| >> free | string | Free balance |
| >> total_balance | string | Total balance |
| fund | Object | |
| > status | string | account status. ACCOUNT_STATUS_NORMAL: normal, ACCOUNT_STATUS_UNSPECIFIED: banned |
| > assets | array | Object |
| >> coin | string | Coin |
| >> free | string | Free balance |
| >> total_balance | string | Total balance |
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/cloud/trade/v3/asset/transfer/query-asset-info'
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 = {
"accountType": "SPOT",
}
create_request(apiKey, secret, params)
Response Example
{
"retCode": 0,
"retMsg": "success",
"result": {
"spot": {
"status": "ACCOUNT_STATUS_NORMAL",
"assets": [
{
"coin": "BTC",
"free": "0.004560435",
"total_balance": "0.004560435"
}
]
}
},
"retExtInfo": {},
"time": 1672136539127
}