Skip to main content

Get Exchange Broker Earning

info
  • Use exchange broker master account to query
  • The data can support up to past 12 months until T-1
  • begin & end are either entered at the same time or not entered, and latest 7 days data are returned by default

API rate limit: 10 req / sec

HTTP Request

GET /private/v1/broker/earnings-info

Request Parameters

ParameterRequiredTypeComments
productTypefalsestringBusiness type. SPOT, DERIVATIVES
beginfalsestringStart time, format: YYYYMMDD, for example, 20231201, indicating that the search time is from December 1, 2023 00:00:00 UTC (inclusive)
endfalsestringEnd time, format: YYYYMMDD, for example, 20231201, indicating that the search time ended on December 2, 2023 at 00:00:00 UTC (not included)
uidfalsestring
  • Enter sub UIDs to query specific data for the specified UID
  • To obtain data for all sub UIDs, do not pass
limitfalseintegerPage quantity limit [1, 1000] Default: 1000
cursorfalseintegerCursor, used for flipping pages, does not need to be passed on the first call

Response Parameters

ParameterTypeComments
coin_detailarrayObject. Rebate data for various businesses
> product_typestringBusiness type. SPOT, DERIVATIVES
> coinstringRebate coin
> rebate_feestringRebate amount
user_detailarrayObject. Transaction details for each sub UID and each business type
> user_idstringUID
> product_typestringBusiness type. SPOT, DERIVATIVES
> coinstringRebate coin
> rebate_feestringRebate amount
> dtstringdate
next_cursorintegerCursor, used for flipping pages

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/broker/earnings-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 = {
"productType": "DERIVATIVES",
}

create_request(apiKey, secret, params)

Response Example

{
"ret_code": 0,
"ret_msg": "OK",
"ext_code": "",
"result": {
"coin_detail": [
{
"product_type": "DERIVATIVES",
"coin": "USDT",
"rebate_fee": "0.845657"
}
],
"user_detail": [
{
"user_id": "101479471",
"product_type": "DERIVATIVES",
"coin": "USDT",
"rebate_fee": "0.22783662",
"dt": "2024-06-12"
},
{
"user_id": "101479471",
"product_type": "DERIVATIVES",
"coin": "USDT",
"rebate_fee": "0.61782038",
"dt": "2024-06-11"
}
],
"next_cursor": 688
},
"ext_info": null,
"time_now": 1718353045150
}