Skip to main content

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 NameRequiredTypeNotes
ccy_listtrue[]stringList 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 NameTypeNotes
balance_list[n].margin_marketstringMargin account name, null for non-margin markets
balance_list[n].ccystringAsset name
balance_list[n].availablestringBalance available
balance_list[n].frozenstringFrozen balance
balance_list[n].updated_atintLatest 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 NameRequiredTypeNotes
ccy_listtrue[]stringList 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
}