ft-pandas-ta

0.3.16 · active · verified Thu Apr 16

ft-pandas-ta is an active Python library (version 0.3.16) that extends Pandas DataFrames with over 130 technical analysis indicators. It functions as an easy-to-use Pandas extension, allowing indicators to be called directly from DataFrames or as standalone functions, with reported correlation tested against TA-Lib. This project is a fork of the popular `pandas-ta` library, maintaining a healthy release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates fetching historical stock data using `yfinance`, then calculating a Simple Moving Average (SMA), Relative Strength Index (RSI), and Bollinger Bands using `ft-pandas-ta`. It showcases both appending indicators directly to the DataFrame and returning them as a Series.

import pandas as pd
import pandas_ta as ta
import yfinance as yf # Common dependency for fetching financial data

# Fetch sample financial data
df = yf.download('AAPL', start='2022-01-01', end='2023-01-01')

# Ensure the index is a DatetimeIndex (yfinance does this by default)
# For other data sources, you might need:
# df.index = pd.to_datetime(df.index)

# Calculate a Simple Moving Average (SMA) and append to DataFrame
df.ta.sma(length=20, append=True)

# Calculate Relative Strength Index (RSI) and get it as a Series
rsi_series = df.ta.rsi(length=14)

# Calculate Bollinger Bands and append multiple columns to DataFrame
df.ta.bbands(append=True)

print(df.tail())
print(rsi_series.tail())

view raw JSON →