Skip to main content

Get Account Balance

The API is used to obtain the available, desirable, frozen, to-be-settled, and in-transit funds (fund purchase and redemption) information for each currency of the user

Request

HTTP MethodGET
HTTP URL/v1/asset/account

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
currencystringNOCurrency (HKD, USD, CNH)

Request Example

# Get Account Balance
# https://open.longportapp.com/docs/trade/asset/account
from longport.openapi import TradeContext, Config

config = Config.from_env()
ctx = TradeContext(config)
resp = ctx.account_balance()
print(resp)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0,
"data": {
"list": [
{
"total_cash": "1759070010.72",
"max_finance_amount": "977582000",
"remaining_finance_amount": "0",
"risk_level": "1",
"margin_call": "2598051051.50",
"currency": "HKD",
"net_assets": "24145.90",
"init_margin": "1540.09",
"maintenance_margin": "1540.09",
"buy_power": "1759070.12",
"cash_infos": [
{
"withdraw_cash": "97592.30",
"available_cash": "195902464.37",
"frozen_cash": "11579339.13",
"settling_cash": "207288537.81",
"currency": "HKD"
},
{
"withdraw_cash": "199893416.74",
"available_cash": "199893416.74",
"frozen_cash": "28723.76",
"settling_cash": "-276806.51",
"currency": "USD"
}
]
}
]
}
}

Response Status

StatusDescriptionSchema
200Successaccountcash_rsp
400Internal ErrorNone

Schemas

accountcash_rsp

NameTypeRequiredDescription
listobject[]falseAccount Balance
∟ total_cashstringtrueTotal Cash
∟ max_finance_amountstringtrueMaximum Financing Amount
∟ remaining_finance_amountstringtrueRemaining Financing Amount
∟ risk_levelstringtrueRisk control level

Option:
0 - safe
1 - medium risk
2 - early warning
3 - danger
∟ margin_callstringtrueMargin Call
∟ net_assetsstringtruenet asset
∟ init_marginstringtrueinitial margin
∟ maintenance_marginstringtruemaintenance margin
∟ currencystringtrueCurrency
∟ buy_powerstringtrueBuy Power
∟ cash_infosobject[]falseCash Details
∟∟ withdraw_cashstringtrueWithdraw Cash
∟∟ available_cashstringtrueAvailable Cash
∟∟ frozen_cashstringtrueFrozen Cash
∟∟ settling_cashstringtrueCash to be Settled
∟∟ currencystringtrueCurrency