# Get Account Cash Flow

get_acc_cash_flow(clearing_date='', trd_env=TrdEnv.REAL, acc_id=0, acc_index=0, cashflow_direction=CashFlowDirection.NONE)

  • Description

    Query the cash flow list of a specified trading account on a specified date. This includes all transactions that affect cash balances, such as deposits/withdrawals, fund transfers, currency exchanges, buying/selling financial assets, margin interest, and securities lending interest.

  • Parameters

    Parameter Type Description
    clearing_date str Clearing date.
    trd_env TrdEnv Trading environment.
    acc_id int Trading account ID.
    acc_index int The account number in the trading account list.
    cashflow_direction CashFlowDirection Filter by the direction of cash flow (e.g., inflow/outflow).
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, account cash flow list is returned.
    str If ret != RET_OK, error description is returned.
    • Account cash flow list format as follows:
      Field Type Description
      clearing_date str Clearing date.
      settlement_date str Settlement date.
      currency Currency Transaction currency.
      cashflow_type str Cash flow type.
      cashflow_direction CashFlowDirection Cash flow direction.
      cashflow_amount float Cash flow amount (positive:inflow, negative:outflow).
      cashflow_remark str Remarks.
  • Example

from moomoo import *
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret, data = get_acc_cash_flow(clearing_date='2025-02-18', trd_env=TrdEnv.REAL, acc_id=0, acc_index=0, cashflow_direction=CahFlowDirection.NONE)
if ret == RET_OK:
    print(data)
    if data.shape[0] > 0:  # If account cash flow list is not empty
        print(data['cashflow_type'][0])  # Get direction of the first cash flow record
        print(data['cashflow_amount'].values.tolist())  # Convert to list
else:
    print('get_acc_cash_flow error: ', data)
trd_ctx.close()

1
2
3
4
5
6
7
8
9
10
11
12
  • Output
   clearing_date     settlement_date     currency     cashflow_type     cashflow_direction     cashflow_amount     cashflow_remark
0  2025-02-27        2025-02-28          HKD             Others                 N/A                   0.00      Opt ASS-P-JXC250227P13000-20250227
1  2025-02-27        2025-03-03          HKD             Others                 OUT               -104000.00
2  2025-02-27        2025-02-27          USD         Fund Redemption            IN                 23000.00     Fund Redemption#Taikang Kaitai US Dollar Money...
3  2025-02-27        2025-02-27          HKD         Fund Redemption            IN                104108.96     Fund Redemption#Taikang Kaitai Hong Kong Dolla...
Others
[0.00, -104000.00, 23000.00, 104108.96]
1
2
3
4
5
6
7

Interface Limitations

  • A maximum of 20 requests per 30 seconds.
  • Cash flows are arranged in chronological order.
  • Can not query cash flow list through paper trading accounts.