Calculate the Money Flow Index (MFI) for a given price series.

The Money Flow Index is a momentum indicator that measures the strength and direction of money flowing in and out of a security by considering both price and volume.

The formula is as follows:

\[\text{MFI} = 100 - (100 / (1 + (\text{positive\_money\_flow} / \text{negative\_money\_flow})))\]

Also known as: MFI, volume-weighted RSI.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Money Flow Index for you. Just ask in plain English.

Calculate the Money Flow Index in Python

The Money Flow Index is available in the Technicals module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_money_flow_index as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_money_flow_index()

Which returns:

Date AAPL MSFT Benchmark
2026-06-18 34.2012 17.0425 45.4099
2026-06-22 40.4098 6.0393 40.4024
2026-06-23 33.9909 13.2653 35.5328
2026-06-24 34.0195 13.2877 35.3632
2026-06-25 31.7751 12.5721 29.9219
2026-06-26 50.9525 34.8784 30.7073
2026-06-29 58.3251 40.8726 36.5958
2026-06-30 65.173 46.3834 44.023
2026-07-01 70.4341 51.8574 49.9149
2026-07-02 71.4645 57.9088 41.6417

Parameters

get_money_flow_index accepts the following parameters:

  • period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
  • close_column (str, optional): The name of the column containing the close prices. Defaults to “Adj Close”.
  • window (int, optional): The number of periods for calculating the MFI. Defaults to 14.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the indicator values. Defaults to False.
  • lag (int | list[int], optional): The lag to use for the growth calculation.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.

The Technicals module page introduces the module, and the sidebar lists all of its functions.

Share