Stock Indicators for Python provides financial market technical indicators from historical price quotes.
Volume-based indicators that analyze trading volume patterns and price-volume relationships to identify accumulation, distribution, and money flow conditions.
Running total of volume based on price direction, used to identify buying and selling pressure.
def get_obv(quotes: Iterable[Quote]):
"""
On-Balance Volume (OBV) - running total of volume based on price direction.
Args:
quotes (Iterable[Quote]): Historical price quotes
Returns:
OBVResults[OBVResult]: Collection of OBV results
"""Volume-weighted RSI that incorporates both price and volume to measure buying/selling pressure.
def get_mfi(quotes: Iterable[Quote], lookback_periods: int = 14):
"""
Money Flow Index (MFI) - volume-weighted RSI measuring money flow.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): Number of periods for calculation (defaults to 14)
Returns:
MFIResults[MFIResult]: Collection of MFI results
"""Measures money flow volume over a specific period to gauge accumulation/distribution.
def get_cmf(quotes: Iterable[Quote], lookback_periods: int = 20):
"""
Chaikin Money Flow (CMF) - measures money flow over specified period.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): Number of periods for calculation (defaults to 20)
Returns:
CMFResults[CMFResult]: Collection of CMF results
"""Average price weighted by volume, commonly used as a benchmark for institutional trading.
def get_vwap(quotes: Iterable[Quote]):
"""
Volume Weighted Average Price (VWAP) - average price weighted by volume.
Args:
quotes (Iterable[Quote]): Historical price quotes
Returns:
VWAPResults[VWAPResult]: Collection of VWAP results
"""Cumulative indicator that uses volume and close location within the period's range.
def get_adl(quotes: Iterable[Quote]):
"""
Accumulation/Distribution Line (ADL) - cumulative volume indicator.
Args:
quotes (Iterable[Quote]): Historical price quotes
Returns:
ADLResults[ADLResult]: Collection of ADL results
"""Oscillator form of the Accumulation/Distribution Line using exponential moving averages.
def get_chaikin_osc(quotes: Iterable[Quote], fast_periods: int = 3, slow_periods: int = 10):
"""
Chaikin Oscillator - EMA difference of Accumulation/Distribution Line.
Args:
quotes (Iterable[Quote]): Historical price quotes
fast_periods (int): Fast EMA periods (defaults to 3)
slow_periods (int): Slow EMA periods (defaults to 10)
Returns:
ChaikinOscResults[ChaikinOscResult]: Collection of Chaikin Oscillator results
"""Volume-based oscillator showing percentage difference between fast and slow volume moving averages.
def get_pvo(quotes: Iterable[Quote], fast_periods: int = 12, slow_periods: int = 26, signal_periods: int = 9):
"""
Price Volume Oscillator (PVO) - percentage difference of volume moving averages.
Args:
quotes (Iterable[Quote]): Historical price quotes
fast_periods (int): Fast EMA periods (defaults to 12)
slow_periods (int): Slow EMA periods (defaults to 26)
signal_periods (int): Signal line EMA periods (defaults to 9)
Returns:
PVOResults[PVOResult]: Collection of PVO results
"""Volume oscillator that combines price direction with volume to identify long-term money flow.
def get_kvo(quotes: Iterable[Quote], fast_periods: int = 34, slow_periods: int = 55, signal_periods: int = 13):
"""
Klinger Volume Oscillator (KVO) - combines price direction with volume.
Args:
quotes (Iterable[Quote]): Historical price quotes
fast_periods (int): Fast EMA periods (defaults to 34)
slow_periods (int): Slow EMA periods (defaults to 55)
signal_periods (int): Signal line EMA periods (defaults to 13)
Returns:
KVOResults[KVOResult]: Collection of KVO results
"""Combines price change with volume to measure buying/selling pressure.
def get_force_index(quotes: Iterable[Quote], lookback_periods: int = 13):
"""
Force Index - combines price change with volume to measure force.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): EMA periods for smoothing (defaults to 13)
Returns:
ForceIndexResults[ForceIndexResult]: Collection of Force Index results
"""Install with Tessl CLI
npx tessl i tessl/pypi-stock-indicators