# Get Capital Flow

# get_capital_flow

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

  • Description

    Get the flow of a specific stock

  • Parameters

    Parameter Type Description
    stock_code str Stock code.
    period_type PeriodType Period Type.
    start str Start time.
    end str End time.
    • The combination of start and end is as follows
      start type end type Description
      str str start and end are the specified dates respectively.
      None str start is 365 days before end.
      str None end is 365 days after start.
      None None end is the current date, start is 365 days before.
  • Return

    Parameter Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, capital flow data is returned.
    str If ret != RET_OK, error description is returned.
    • Capital flow data format as follows:
      Field Type Description
      in_flow float Net inflow of capital.
      main_in_flow float Block Orders Net Inflow.
      super_in_flow float Extra-large Orders Net Inflow.
      big_in_flow float Large Orders Net Inflow.
      mid_in_flow float Medium Orders Net Inflow.
      sml_in_flow float Small Orders Net Inflow.
      capital_flow_item_time str Start time string.
      last_valid_time str Last valid time string of data.
  • Example

from moomoo 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]) # Take the first net inflow of capital
    print(data['in_flow'].values.tolist()) # Convert to list
else:
    print('error:', data)
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
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

Interface Limitations

  • A maximum of 30 requests per 30 seconds
  • Supported for stocks, warrants and funds only
  • Historical period (day, month, year) Only provides data for the latest 1 year; Intraday period only provides data for the latest day.
  • Data with historical period (day, month, year), is only supported for the last 2 years. While Data with intraday period is only supported for the latest day.
  • Output data only includes tha data during Regular Trading Hours, not the data during Pre and Post-Market Hours.