Technical Analysis Library in Python for financial time series datasets with 43 indicators across Volume, Volatility, Trend, Momentum, and Others categories
npx @tessl/cli install tessl/pypi-ta@0.11.0A comprehensive Python library for feature engineering from financial time series datasets (Open, High, Low, Close, Volume). Built on Pandas and NumPy, the TA library provides 43 technical indicators across five categories: Volume, Volatility, Trend, Momentum, and Others, offering both class-based and functional APIs for each indicator.
pip install taimport taFor adding all features at once:
from ta import add_all_ta_features, add_volume_ta, add_volatility_ta, add_trend_ta, add_momentum_ta, add_others_taFor individual indicators:
from ta.volume import OnBalanceVolumeIndicator, MFIIndicator
from ta.trend import MACD, EMAIndicator
from ta.momentum import RSIIndicator, StochasticOscillatorimport pandas as pd
import ta
# Load your financial data with OHLCV columns
df = pd.DataFrame({
'Open': [100, 101, 102, 99, 98],
'High': [105, 103, 104, 101, 100],
'Low': [99, 100, 101, 98, 97],
'Close': [104, 102, 103, 100, 99],
'Volume': [1000, 1100, 900, 1200, 800]
})
# Add all technical analysis features at once
df_with_indicators = ta.add_all_ta_features(
df,
open="Open",
high="High",
low="Low",
close="Close",
volume="Volume"
)
# Add specific category of indicators
df_trend = ta.add_trend_ta(df, high="High", low="Low", close="Close")
# Use individual indicators (class-based approach)
from ta.momentum import RSIIndicator
rsi = RSIIndicator(close=df['Close'], window=14)
df['RSI'] = rsi.rsi()
# Use individual indicators (functional approach)
from ta.momentum import rsi
df['RSI'] = rsi(close=df['Close'], window=14)The TA library follows a consistent design pattern across all indicators:
IndicatorMixinfillna parameter for handling NaN valuesThis dual API approach provides flexibility for different use cases while maintaining consistency across all 43 indicators.
High-level functions for batch adding technical analysis features to DataFrames, supporting all 43 indicators organized by category.
def add_all_ta_features(df, open, high, low, close, volume, fillna=False, colprefix="", vectorized=False): ...
def add_volume_ta(df, high, low, close, volume, fillna=False, colprefix="", vectorized=False): ...
def add_volatility_ta(df, high, low, close, fillna=False, colprefix="", vectorized=False): ...
def add_trend_ta(df, high, low, close, fillna=False, colprefix="", vectorized=False): ...
def add_momentum_ta(df, high, low, close, volume, fillna=False, colprefix="", vectorized=False): ...
def add_others_ta(df, close, fillna=False, colprefix=""): ...Nine volume-based technical indicators that analyze the relationship between price movements and trading volume to identify buying/selling pressure and confirm price trends.
class AccDistIndexIndicator: ...
class OnBalanceVolumeIndicator: ...
class ChaikinMoneyFlowIndicator: ...
class ForceIndexIndicator: ...
class EaseOfMovementIndicator: ...
class VolumePriceTrendIndicator: ...
class NegativeVolumeIndexIndicator: ...
class MFIIndicator: ...
class VolumeWeightedAveragePrice: ...Five volatility-based indicators that measure price volatility and identify potential support/resistance levels through channel analysis and volatility bands.
class AverageTrueRange: ...
class BollingerBands: ...
class KeltnerChannel: ...
class DonchianChannel: ...
class UlcerIndex: ...Twenty trend-based indicators that identify trend direction, strength, and potential reversal points through moving averages, oscillators, and directional movement analysis.
class AroonIndicator: ...
class MACD: ...
class EMAIndicator: ...
class SMAIndicator: ...
class WMAIndicator: ...
class TRIXIndicator: ...
class MassIndex: ...
class IchimokuIndicator: ...
class KSTIndicator: ...
class DPOIndicator: ...
class CCIIndicator: ...
class ADXIndicator: ...
class VortexIndicator: ...
class PSARIndicator: ...
class STCIndicator: ...Eleven momentum-based indicators that measure the rate of price change and identify overbought/oversold conditions, momentum shifts, and potential reversal points.
class RSIIndicator: ...
class TSIIndicator: ...
class UltimateOscillator: ...
class StochasticOscillator: ...
class KAMAIndicator: ...
class ROCIndicator: ...
class AwesomeOscillatorIndicator: ...
class WilliamsRIndicator: ...
class StochRSIIndicator: ...
class PercentagePriceOscillator: ...
class PercentageVolumeOscillator: ...Three fundamental financial analysis indicators for calculating various types of returns from price data.
class DailyReturnIndicator: ...
class DailyLogReturnIndicator: ...
class CumulativeReturnIndicator: ...Core utility functions and base classes used throughout the library for data handling and indicator calculations.
class IndicatorMixin: ...
def dropna(df): ...# Base class for all indicators
class IndicatorMixin:
def _check_fillna(self, series, value=0):
"""Check if fillna flag is True"""
...
@staticmethod
def _true_range(high, low, prev_close):
"""Calculate true range"""
...