Spot Account Balance Subscription
Info
- Before using this function, you need to call the
server.sign
method for signature authentication. For specific signature rules, please refer to Authentication - The push delay of this method is: real-time
Subscribe to Asset Balance
- Method:
balance.subscribe
- Parameters:
Parameter Name | Required | Type | Notes |
---|---|---|---|
ccy_list | true | []string | List of asset names |
- Subscription example:
// Subscribe to singular asset balance
{
"method": "balance.subscribe",
"params": {"ccy_list": ["BTC"]},
"id": 1
}
// Subscribe to multiple asset balances
{
"method": "balance.subscribe",
"params": {"ccy_list": ["BTC", "ETH"]},
"id": 1
}
// Subscribe to all asset balances
{
"method": "balance.subscribe",
"params": {"ccy_list": []},
"id": 1
}
Asset Balance Push
- Method:
balance.update
- Parameters:
Parameter Name | Type | Notes |
---|---|---|
balance_list[n].margin_market | string | Margin account name, null for non-margin markets |
balance_list[n].ccy | string | Asset name |
balance_list[n].available | string | Balance available |
balance_list[n].frozen | string | Frozen balance |
balance_list[n].updated_at | int | Latest update timestamp, millisecond |
- Example:
{
"method": "balance.update",
"data": {
"balance_list": [
{
"margin_market": "BTCUSDT",
"ccy": "BTC",
"available": "44.62207740",
"frozen": "0.00000000",
"updated_at": 1689152421692
},
{
"margin_market": "BTCUSDT",
"ccy": "USDT",
"available": "44.62207740",
"frozen": "0.00000000",
"updated_at": 1689152421692
}
]
},
"id": null
}
Unsubscribe to Asset Balance
- Method:
balance.unsubscribe
- Parameters:
Parameter Name | Required | Type | Notes |
---|---|---|---|
ccy_list | true | []string | List of asset names |
- Example:
// Unsubscribe to singular asset balance
{
"method": "balance.unsubscribe",
"params": {"ccy_list": ["BTC"]},
"id": 1
}
// Unsubscribe to multiple asset balances
{
"method": "balance.unsubscribe",
"params": {"ccy_list": ["BTC", "ETH"]},
"id": 1
}
// Unsubscribe to all asset balances
{
"method": "balance.unsubscribe",
"params": {"ccy_list": []},
"id": 1
}