Skip to main content

Get Spot Account Balance

API Description

This interface retrieves the available balance of the user's spot account, including all holdings across different instruments.

Note: Spot account balance data is accessible via both RESTfulRESTful and Websocket APIs. This page describes the Restful API. For information on the Websocket API, please click here

Precautions

  1. If a user holds no assets, an empty response will be returned.

Authentication

This is a private interface and requires authentication. For details on using the RESTful API, refer to Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface.

Request Method

POST

Endpoint

/api/v1/private?command=returnBalances

Frequency limit

The frequency limit for this interface is 3 requests/s per user ID. In addition to this per-interface limit, a global rate limit is also enforced.

For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here

Request Parameters

This interface does not require any request parameter.

Response Parameters

The response contains the instrument names and the corresponding amounts held in the user's spot account.

ParameterTypeDescription
dataJsonData object containing all holdings.
msgStringSUCCESS

Request Example

The following Python code shows to get available balance in user's spot account .

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface.

api_url = "/api/v1/private?command=returnBalances"
method = "post"
params = {}
SpotRestfulPrivate(host, api_url, method, api_key, params, secret_key) # function SpotRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface.

Response Example

The following is an example response returned by the above Python request:

{'code': '200',
'data': {
'BTC': '0.0012',
'CWT': '400.000',
'SAND': '108.467',
'ETH': '0.0330',
'USDT': '257.518301140000000'},
'msg': 'SUCCESS',
'success': True,
'failed': False}