Money Flow Index (MFI)
get_mfi(quotes, lookback_periods=14)
Parameters
name | type | notes |
---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
lookback_periods | int, default 14 | Number of periods (N ) in the lookback period. Must be greater than 1. |
Historical quotes requirements
You must have at least N+1
historical quotes to cover the warmup periods.
quotes
is an Iterable[Quote]
collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
Return
MFIResults[MFIResult]
- This method returns a time series of all available indicator values for the
quotes
provided. MFIResults
is just a list ofMFIResult
.- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
N
periods will haveNone
MFI values since they cannot be calculated.
MFIResult
name | type | notes |
---|---|---|
date | datetime | Date |
mfi | float, Optional | Money Flow Index |
Utilities
See Utilities and Helpers for more information.
Example
from stock_indicators import indicators
# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")
# Calculate
results = indicators.get_mfi(quotes, 14)
About Money Flow Index (MFI)
Created by Quong and Soudack, the Money Flow Index is a price-volume oscillator that shows buying and selling momentum. [Discuss] 💬