# Get Account Funds

# accinfo_query

accinfo_query(trd_env=TrdEnv.REAL, acc_id=0, acc_index=0, refresh_cache=False, currency=Currency.HKD)

  • Description

    Query fund data such as net asset value, securities market value, cash, and purchasing power of trading accounts.

  • Parameters

    Parameter Type Description
    trd_env TrdEnv Trading environment
    acc_id int Trading account ID.
    acc_index int The account number in the trading account list.
    refresh_cache bool Whether to refresh the cache.
    currency Currency The display currency of the funds.
  • Return

    Parameter Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, fund data is returned.
    str If ret != RET_OK, error description is returned.
    • Fund data format as follows:
      Field Type Description
      power float Maximum Buying Power.
      max_power_short float Short Buying Power.
      net_cash_power float Cash Buying Power.
      total_assets float Net Assets.
      cash float Cash.
      market_val float Securities Market Value.
      long_mv float Long Market Value.
      short_mv float Short Market Value.
      pending_asset float Asset in Transit.
      interest_charged_amount float Interest Charged Amount.
      frozen_cash float Funds on Hold.
      avl_withdrawal_cash float Withdrawable Cash.
      max_withdrawal float Maximum Withdrawal.
      currency Currency The currency used for this query.
      available_funds float Available funds.
      unrealized_pl float Unrealized gain or loss.
      realized_pl float Realized gain or loss.
      risk_level CltRiskLevel Risk control level.
      risk_status CltRiskStatus Risk status.
      initial_margin float Initial Margin.
      margin_call_margin float Margin-call Margin.
      maintenance_margin float Maintenance Margin.
      hk_cash float HKD Cash.
      hk_avl_withdrawal_cash float HKD Withdrawable Cash.
      us_cash float USD Cash.
      us_avl_withdrawal_cash float USD Withdrawable Cash.
      jp_cash float JPY Cash.
      jp_avl_withdrawal_cash float JPY Withdrawable Cash.
      pdt_seq string Day Trades Left.
      is_pdt bool Is it marked as a PDT.
      beginning_dtbp float Beginning DTBP.
      remaining_dtbp float Remaining DTBP.
      dt_call_amount float Day-trading Call Amount.
      dt_status DtStatus Day-trading Status.
      cn_cash float CNH Cash.
      cn_avl_withdrawal_cash float CNH Withdrawable Cash.
      sg_cash float SGD Cash.
      sg_avl_withdrawal_cash float SGD Withdrawable Cash.
      au_cash float AUD Cash.
      au_avl_withdrawal_cash float AUD Withdrawable Cash.
  • Example

from futu import *
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret, data = trd_ctx.accinfo_query()
if ret == RET_OK:
    print(data)
    print(data['power'][0])  # Get the first buying power
    print(data['power'].values.tolist())  # convert to list
else:
    print('accinfo_query error: ', data)
trd_ctx.close()  # Close the current connection
1
2
3
4
5
6
7
8
9
10
  • Output
      power  max_power_short  net_cash_power  total_assets     cash  market_val  long_mv  short_mv  pending_asset  interest_charged_amount  frozen_cash  avl_withdrawal_cash  max_withdrawal currency available_funds unrealized_pl realized_pl risk_level risk_status  initial_margin  margin_call_margin  maintenance_margin hk_cash hk_avl_withdrawal_cash us_cash us_avl_withdrawal_cash
0  55926.96          46605.8         5880.48      50080.48  5880.48     44200.0  44200.0       0.0            0.0                      0.0          0.0              5880.48        25755.18      N/A             N/A           N/A         N/A        N/A      LEVEL2         22083.0             19874.7             15458.1     N/A                    N/A     N/A                    N/A
55926.96
[55926.96]
1
2
3
4

Interface Limitations

  • A maximum of 10 requests per 30 seconds
  • It will be restricted by the frequency limit for this interface, only when refresh_cache is True