账户余额
接口说明
功能说明:根据账户id查询账户资产。
适用对象:通过OpenAPI开发平台对接webull的客户。
请求URL:/account/balance
请求方式:GET
频次限制:每个App ID调用频次限制为30秒10次。
请求参数
参数 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
account_id | String | 是 | 账户id | 20150320010101001 |
total_asset_currency | String | 否 | 资产计价币种,只支持 USD | USD |
响应参数
参数 | 类型 | 描述 | 示例值 |
---|---|---|---|
account_id | String | 账户id | 13467788 |
total_asset_currency | String | 资产计价币种,只支持 USD | USD |
total_asset | String | 账户总资产,币种为total_asset_currency字段值。 total_asset=sum(net_liquidation_value*汇率) | 1247724759.52 |
total_market_value | String | 总市值,币种为total_asset_currency字段值。 total_market_value=sum(positions_market_value*汇率) | 89038914.52 |
total_cash_balance | String | 现金总额,币种为total_asset_currency字段值。 total_cash_balance=sum(cash_balance*汇率) | 1158685845.00 |
margin_utilization_rate | String | 融资使用率,百分比。预留参数 | 1.00 |
account_currency_assets | []Account_Currency_Asset | 账户资产列表 |
上述的汇率=Account_Currency_Asset中的currency币种兑换成total_asset_currency币种的汇率。
Account_Currency_Asset
参数 | 类型 | 描述 | 示例值 |
---|---|---|---|
currency | String | 币种 | USD |
net_liquidation_value | String | 净资产 net_liquidation_value=positions_market_value+cash_balance+pending_incoming | 458809435.44 |
positions_market_value | String | 持仓市值 | 153208546.14 |
cash_balance | String | 现金余额 | 305600889.30 |
margin_power | String | 融资购买力 | 305587431.94 |
cash_power | String | 现金购买力 | 305587431.94 |
pending_incoming | String | 在途资金 | 0.00 |
cash_frozen | String | 冻结资金 | 13457.36 |
available_withdrawal | String | 可提现金额 | 305587431.94 |
interests_unpaid | String | 待付利息 | 0.00 |
请求示例
- Python
- Java
from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region
from webullsdktrade.common.currency import Currency
api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.account.get_account_balance(account_id, Currency.USD.name)
if response.status_code == 200:
account_balance = response.json()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
AccountBalance accountBalance = apiService.getAccountBalance(accountId, currency);
响应示例
{
"account_id":"6TGIBSMG28Q35OVA465T99VHPB",
"total_asset_currency":"USD",
"total_market_value":"0.00",
"margin_utilization_rate":"2.00",
"account_currency_assets":[
{
"currency":"USD",
"netAsset":"400000000.00",
"marketValue":"0.00",
"cashBalance":"400000000.00",
"marginPower":"1599995029.60",
"cashPower":"4799985859.00",
"cashInTransit":"0.00",
"cashFrozen":"485.10",
"cashWithdraw":"-2485.20",
"interestsUnpaid":"0.00"
}
]
}
异常示例
{
"error_code": "INVALID_TOKEN",
"message": "401 UNAUTHORIZED \"app_id and account_id not related\""
}