# 查询账户现金流水

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

  • 介绍

    查询交易业务账户在指定日期的现金流水数据。数据覆盖出入金、调拨、货币兑换、买卖金融资产、融资融券利息等所有导致现金变动的事项。

  • 参数

    参数 类型 说明
    clearing_date str 清算日期
    trd_env TrdEnv 交易环境
    acc_id int 交易业务账户 ID
    acc_index int 交易业务账户列表中的账户序号
    cashflow_direction CashFlowDirection 筛选现金流方向
  • 返回

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data pd.DataFrame 当 ret == RET_OK 时,返回交易业务账户现金流水列表格式
    str 当 ret != RET_OK 时,返回错误描述
    • 交易业务账户现金流水列表格式如下:
      字段 类型 说明
      clearing_date str 清算日期
      settlement_date str 交收日期
      currency Currency 币种
      cashflow_type str 现金流类型
      cashflow_direction CashFlowDirection 现金流方向
      cashflow_amount float 金额(正数表示流入,负数表示流出)
      cashflow_remark str 备注
  • 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:  # 如果现金流水列表不为空
        print(data['cashflow_type'][0])  # 获取第一条流水的现金流类型
        print(data['cashflow_amount'].values.tolist())  # 转为 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             其他                 N/A                   0.00      Opt ASS-P-JXC250227P13000-20250227
1  2025-02-27        2025-03-03          HKD             其他                 OUT               -104000.00
2  2025-02-27        2025-02-27          USD            基金赎回               IN                 23000.00     Fund Redemption#Taikang Kaitai US Dollar Money...
3  2025-02-27        2025-02-27          HKD            基金赎回               IN                104108.96     Fund Redemption#Taikang Kaitai Hong Kong Dolla...
其他
[0.00, -104000.00, 23000.00, 104108.96]
1
2
3
4
5
6
7

接口限制

  • 每 30 秒内最多请求 20 次现金流水接口。
  • 现金流水,按照时间的“顺序”进行排列。
  • 模拟账户不支持查询现金流水。