Account Balance
Interface Description
Function description: Query account assets according to account id.
URL: /account/balance
Method: GET
Rate limit: The calling frequency of each App ID is limited to 10 times in 30 seconds.
Request Parameters
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
account_id | String | Yes | Account ID | co393b0ab01 |
Response Parameter
Parameter | Type | Description | Example value |
---|---|---|---|
account_id | String | Account ID | ce1y2j80 |
currency | String | Currency, USD only | USD |
total_amount | String | The total assets of the account | 1247724759.52 |
available_amount | String | Available Amount | 17724759.52 |
purchasing_amount | String | Buying Power | 100 |
cash_balance | String | Cash balance | 1158685845.00 |
total_value | String | Total asset | 1247724759.52 |
total_market_value | String | Total market value | 1247724759.52 |
Request Example
- Python
- Java
from webullpaysdktrade.api import API
from webullpaysdkcore.client import ApiClient
from webullpaysdkcore.common.region import Region
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
account_id = "account_id"
api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.account.get_account_balance(account_id)
if response.status_code == 200:
account_balance = response.json()
print(account_balance)
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
AccountBalance accountBalance = apiService.getAccountBalance("account_id");
//print
System.out.println(JsonSerializer.toJson(accountBalance, SerializeConfig.builder().underscoresToCamel(true).build()));
Response Example
{
"account_id": "co393b0ab01",
"currency": "USD",
"total_amount": "1103.47",
"cash_balance": "1113.47",
"purchasing_amount": "1113.47",
"available_amount": "1103.47",
"total_market_value": "1392.08",
"total_value": "2505.55"
}
Exception Example
{
"error_code": "INVALID_TOKEN",
"message": "401 UNAUTHORIZED \"app_id and account_id not related\""
}