Chaikin Money Flow (CMF)
Calculate the Chaikin Money Flow (CMF) for a given price series.
The Chaikin Money Flow sums the same Money Flow Volume used by the Accumulation/ Distribution Line over a rolling window and normalizes it by the window’s total volume, turning the running (unbounded) Accumulation/Distribution Line into a bounded oscillator. Sustained readings above zero indicate buying pressure (accumulation) is dominating over the window, while sustained readings below zero indicate selling pressure (distribution).
The formula is as follows:
\[\text{Money Flow Multiplier} = ((\text{Close} - \text{Low}) - (\text{High} - \text{Close})) / (\text{High} - \text{Low})\] \[\text{Money Flow Volume} = \text{Money Flow Multiplier} \cdot \text{Volume}\] \[\text{CMF} = \operatorname{Sum}(\text{Money Flow Volume},\; \text{window}) / \operatorname{Sum}(\text{Volume},\; \text{window})\]Also known as: CMF, Chaikin Money Flow.
Chaikin Money Flow (CMF) in Python
get_chaikin_money_flow is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_chaikin_money_flow as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_chaikin_money_flow()
Parameters
get_chaikin_money_flow 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 column name for closing prices in the historical data. Defaults to “Adj Close”.
- window (int, optional): Number of periods to sum the Money Flow Volume and volume over. Defaults to 20.
- 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 Chaikin Money Flow. 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.