Skip to main content

A lightweight technical indicators library for pandas DataFrames and Series

Project description

pandas_ti

PyPI version Python 3.12+ License: MIT

A lightweight and extensible technical analysis library for pandas DataFrames and Series.

Features

  • Zero Configuration - Automatic OHLCV column detection with multiple naming conventions
  • Pandas Native - Seamless integration via .ti accessor for DataFrames and Series
  • Self-Documenting - Built-in help system with rich console output
  • Extensible - Easy to add custom indicators with decorator pattern
  • Fast & Lightweight - Minimal dependencies, maximum performance

Quick Start

Installation

pip install pandas-ti

Basic Usage

There are two ways to use indicators in pandas_ti:

1. Accessor Pattern (Recommended)

Use the .ti accessor for seamless integration with pandas. High and Low columns are auto-injected from your DataFrame.

import pandas as pd
import pandas_ti
import yfinance as yf

# Get market data
df = yf.Ticker("AAPL").history(period="1y")

# DataFrame indicators - automatic OHLCV detection
df['ATR_14'] = df.ti.ATR(n=14)
df['RTR'] = df.ti.RTR()
zz = df.ti.ZigZag(pct=0.05)

# Series indicators - work on any Series
df['SMA_20'] = df['Close'].ti.SMA(n=20)
df['EMA_50'] = df['Close'].ti.EMA(n=50)

2. Direct Import (Manual)

Import indicators directly for more control. You must explicitly pass the required data.

import pandas_ti as ti
import yfinance as yf

df = yf.Ticker("AAPL").history(period="1y")

# Import and use indicators directly
from pandas_ti import ATR, RTR, ZigZag, SMA, EMA

# DataFrame indicators - must specify columns
df['ATR_14'] = ATR(High=df['High'], Low=df['Low'], Close=df['Close'], n=14)
df['RTR'] = RTR(High=df['High'], Low=df['Low'], Close=df['Close'])
zz = ZigZag(High=df['High'], Low=df['Low'], pct=0.05)

# Series indicators - pass Series directly
df['SMA_20'] = SMA(series=df['Close'], n=20)
df['EMA_50'] = EMA(series=df['Close'], n=50)

# Alternative: use package-level access
df['ATR_14'] = ti.ATR(High=df['High'], Low=df['Low'], Close=df['Close'], n=14)

Built-in Help System

Help with Accessor Pattern

# List all available indicators
df.ti.indicators()
df['Close'].ti.indicators()

# Get detailed help for specific indicator
df.ti.help('ATR')
df['Close'].ti.help('SMA')

Help with Direct Import

from pandas_ti import ZigZag, ATR

# Using help() function
help(ZigZag)
help(ATR)

# Using __doc__ attribute
print(ZigZag.__doc__)
print(ATR.__doc__)

Available Indicators

DataFrame Indicators (require OHLCV data)

These indicators require High, Low, and Close columns (auto-detected with accessor pattern).

Indicator Description Parameters Return Type
TR True Range None pd.Series
ATR Average True Range n (window size) pd.Series
RTR Relative True Range None pd.Series
ARTR Average Relative True Range n (window size) pd.Series
SRTR Standardized Relative True Range n, N=1000, expand=False, method='cluster' SRTRClass
ZigZag Significant price reversals detector pct (percentage threshold) ZigZagClass

Series Indicators (work on any Series)

These indicators work on any pandas Series.

Indicator Description Parameters Return Type
SMA Simple Moving Average n (window size) pd.Series
EMA Exponential Moving Average n (span) pd.Series

Technical Details

Automatic Column Detection

The library automatically detects OHLCV columns using common naming variations:

Column Type Accepted Names
Open Open, OPEN, open, O, o
High High, HIGH, high, H, h
Low Low, LOW, low, L, l
Close Close, CLOSE, close, C, c
Volume Volume, VOLUME, volume, Vol, vol, V, v

Requirements

Core Dependencies

  • Python >= 3.12
  • pandas >= 2.3.3
  • numpy >= 2.3.3
  • rich >= 14.2.0
  • scipy >= 1.16.2
  • statsmodels >= 0.14.5

Optional dependencies

  • yfinance >= 0.2.66 (for examples and testing)
  • matplotlib >= 3.10.7 (for visualization)
  • mplfinance >= 0.12.10b0 (for financial charts)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Javier Calzada Espuny

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas_ti-1.1.0.tar.gz (192.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandas_ti-1.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file pandas_ti-1.1.0.tar.gz.

File metadata

  • Download URL: pandas_ti-1.1.0.tar.gz
  • Upload date:
  • Size: 192.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pandas_ti-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1302b1ea76d45e5dcdd39ffabc1e8f3d7595c11e432b47d232324b45e512ee2f
MD5 8b6e33c3f5ed5076c7f86fe8ac873079
BLAKE2b-256 88c07fc7f38c16de016cdc905e14f24e782c4ecd7d42e4e41719103b590b6187

See more details on using hashes here.

File details

Details for the file pandas_ti-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pandas_ti-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pandas_ti-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25fdbd7754f22a50f1869a26fba5aaefaba4dad44e399558a028162b3cd503b7
MD5 50b3497828efdea3cf79e670cf4f805a
BLAKE2b-256 6608deda4e21f3ca3660d2ed6416f061864489a31ad2a0257c22e5686326d148

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page