# 获取资金流向

# get_capital_flow

get_capital_flow(stock_code, period_type = PeriodType.INTRADAY, start=None, end=None)

  • 介绍

    获取个股资金流向

  • 参数

    参数 类型 说明
    stock_code str 股票代码
    period_type PeriodType 周期类型
    start str 开始时间
    end str 结束时间
    • start 和 end 的组合如下
      start 类型 end 类型 说明
      str str start 和 end 分别为指定的日期
      None str start 为 end 往前 365 天
      str None end 为 start 往后 365 天
      None None end 为 当前日期,start 往前 365 天
  • 返回

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data pd.DataFrame 当 ret == RET_OK,返回资金流向数据
    str 当 ret != RET_OK,返回错误描述
    • 资金流向数据格式如下:
      字段 类型 说明
      in_flow float 整体净流入
      main_in_flow float 主力大单净流入
      super_in_flow float 特大单净流入
      big_in_flow float 大单净流入
      mid_in_flow float 中单净流入
      sml_in_flow float 小单净流入
      capital_flow_item_time str 开始时间
      last_valid_time str 数据最后有效时间
  • Example

from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

ret, data = quote_ctx.get_capital_flow("HK.00700", period_type = PeriodType.INTRADAY)
if ret == RET_OK:
    print(data)
    print(data['in_flow'][0])    # 取第一条的净流入的资金额度
    print(data['in_flow'].values.tolist())   # 转为 list
else:
    print('error:', data)
quote_ctx.close() # 结束后记得关闭当条连接,防止连接条数用尽
1
2
3
4
5
6
7
8
9
10
11
  • Output
    last_valid_time       in_flow  ...  main_in_flow  capital_flow_item_time
0               N/A -1.857915e+08  ... -1.066828e+08     2021-06-08 00:00:00
..              ...           ...  ...           ...                     ...
245             N/A  2.179240e+09  ...  2.143345e+09     2022-06-08 00:00:00

[246 rows x 8 columns]
-185791500.0
[-185791500.0, -18315000.0, -672100100.0, -714394350.0, -698391950.0, -818886750.0, 304827400.0, 73026200.0, -2078217500.0, 
..                   ...           ...                    ...
2031460.0, 638067040.0, 622466600.0, -351788160.0, -328529240.0, 715415020.0, 76749700.0, 2179240320.0]
1
2
3
4
5
6
7
8
9
10

接口限制

  • 每 30 秒内最多请求 30 次获取资金流向接口。
  • 仅支持正股、窝轮和基金。
  • 历史周期(日、月、年)仅提供最近 1 年数据;实时周期仅提供最新一天的数据。
  • 返回数据只包括盘中数据,不包含盘前盘后数据。