# Get the List of Trading Accounts

get_acc_list()

  • Description

    Get a list of trading accounts. Before calling other trading interfaces, please obtain this list first and confirm that the trading account to be operated is correct.

  • Parameters

  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, trading account list is returned.
    str If ret != RET_OK, error description is returned.
    • Trading account list format as follows:
      Field Type Description
      acc_id int Trading account.
      trd_env TrdEnv Trading environment.
      acc_type TrdAccType Account type.
      uni_card_num str Universal account number, same as the display in the mobile terminal.
      card_num str Trading account number
      sim_acc_type SimAccType Simulate account type.
      security_firm SecurityFirm Securities firm to which the account belongs.
      trdmarket_auth list Transaction market authority.
      acc_status AccStatus Account status.
  • Description

    After the paper trading of HK/US stock options is opened, this function will return 2 paper trading accounts when obtaining the list of HK/US trading accounts. The first one is the original account, and the second one is the option paper trading account.

  • 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.get_acc_list()
if ret == RET_OK:
    print(data)
    print(data['acc_id'][0])  # Get the first account ID
    print(data['acc_id'].values.tolist())  # convert to list
else:
    print('get_acc_list error: ', data)
trd_ctx.close()
1
2
3
4
5
6
7
8
9
10
  • Output
               acc_id   trd_env acc_type      uni_card_num          card_num   security_firm sim_acc_type            trdmarket_auth acc_status
0  281756479345015383      REAL   MARGIN  1001289516908051  1001329805025007  FUTUSECURITIES          N/A  [HK, US, HKFUND, USFUND]     ACTIVE
1             8377516  SIMULATE     CASH               N/A               N/A             N/A        STOCK                      [HK]     ACTIVE
2            10741586  SIMULATE   MARGIN               N/A               N/A             N/A       OPTION                      [HK]     ACTIVE
3  281756455983234027      REAL   MARGIN               N/A  1001100321720699  FUTUSECURITIES          N/A                      [HK]   DISABLED
281756479345015383
[281756479345015383, 8377516, 10741586, 281756455983234027]
1
2
3
4
5
6
7