跳到主要內容

獲取賬戶資金

該接口用於獲取用戶每個幣種可用、可取、凍結、待結算金額、在途資金 (基金申購贖回) 信息。

SDK Links

Python
longport.openapi.TradeContext.account_balance
Rust
longport::trade::TradeContext#account_balance
Go
TradeContext.AccountBalance
Node.js
TradeContext#accountBalance

Request

HTTP MethodGET
HTTP URL/v1/asset/account

Parameters

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

NameTypeRequiredDescription
currencystringNO幣種(HKD、USD、CNH)

Request Example

# 獲取賬戶資金
# 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
200返回成功accountcash_rsp
400內部錯誤None

Schemas

accountcash_rsp

NameTypeRequiredDescription
listobject[]false賬戶資金信息
∟ total_cashstringtrue現金總額
∟ max_finance_amountstringtrue最大融資金額
∟ remaining_finance_amountstringtrue剩餘融資金額
∟ risk_levelstringtrue風控等級

可選值:
0 - 安全
1 - 中風險
2 - 預警
3 - 危險
∟ margin_callstringtrue追繳保證金
∟ net_assetsstringtrue淨資產
∟ init_marginstringtrue初始保證金
∟ maintenance_marginstringtrue維持保證金
∟ currencystringtrue幣種
∟ buy_powerstringtrue購買力
∟ cash_infosobject[]false現金詳情
∟∟ withdraw_cashstringtrue可提現金
∟∟ available_cashstringtrue可用現金
∟∟ frozen_cashstringtrue凍結現金
∟∟ settling_cashstringtrue待結算現金
∟∟ currencystringtrue幣種