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.
SDK Links
Python  | longport.openapi.TradeContext.account_balance | 
Rust  | longport::trade::TradeContext#account_balance | 
Go  | TradeContext.AccountBalance | 
Node.js  | TradeContext#accountBalance | 
Request 
| HTTP Method | GET | 
| HTTP URL | /v1/asset/account | 
Parameters 
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description | 
|---|---|---|---|
| currency | string | NO | Currency (HKD, USD, CNH) | 
Request Example 
python
# 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 
json
{
  "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"
          }
        ],
        "frozen_transaction_fees": [
          {
            "currency": "USD",
            "frozen_transaction_fee": "6.51"
          }
        ]
      }
    ]
  }
}Response Status 
| Status | Description | Schema | 
|---|---|---|
| 200 | Success | accountcash_rsp | 
| 400 | Internal Error | None | 
Schemas 
accountcash_rsp 
| Name | Type | Required | Description | 
|---|---|---|---|
| list | object[] | false | Account Balance | 
| ∟ total_cash | string | true | Total Cash | 
| ∟ max_finance_amount | string | true | Maximum Financing Amount | 
| ∟ remaining_finance_amount | string | true | Remaining Financing Amount | 
| ∟ risk_level | string | true | Risk control level  Option: 0 - safe 1 - medium risk2 - early warning3 - danger | 
| ∟ margin_call | string | true | Margin Call | 
| ∟ net_assets | string | true | net asset | 
| ∟ init_margin | string | true | initial margin | 
| ∟ maintenance_margin | string | true | maintenance margin | 
| ∟ currency | string | true | Currency | 
| ∟ buy_power | string | true | Buy Power | 
| ∟ cash_infos | object[] | false | Cash Details | 
| ∟∟ withdraw_cash | string | true | Withdraw Cash | 
| ∟∟ available_cash | string | true | Available Cash | 
| ∟∟ frozen_cash | string | true | Frozen Cash | 
| ∟∟ settling_cash | string | true | Cash to be Settled | 
| ∟∟ currency | string | true | Currency | 
| ∟ frozen_transaction_fees | object[] | false | frozen fees | 
| ∟∟ currency | string | false | currency | 
| ∟∟ frozen_transaction_fee | string | false | frozen amount |