Registry / data / ta
library0.11.0pypypi✓ verified 22d ago

The `ta` library (Technical Analysis Library in Python, also known as `python-ta`) is a Python library designed for feature engineering on financial time series datasets. It provides a comprehensive collection of over 150 technical indicators and candlestick pattern recognition functions, built entirely on the Pandas library. Version 0.11.0 is the current release, and the project maintains an active, albeit intermittent, release cadence with new features and bug fixes.

pip install ta
INSTALL
IMPORT
SIG · TA
T
ta
datapythonv0.11.0
Install
8.8s avg
Import
928ms
Disk
166MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.11.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.954s · 166.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.8s · import 0.902s · 159MB
166MB installed
● package 166MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

add_all_ta_features
from ta import add_all_ta_features
import ta
While `import ta` works, `add_all_ta_features` is a common entry point to apply many indicators easily, or import specific indicator classes from `ta.momentum`, `ta.trend`, etc.
dropna
from ta.utils import dropna
Utility function for cleaning NaN values from DataFrames.
RSIIndicator
from ta.momentum import RSIIndicator
Example of importing a specific indicator class. Most indicators are available under submodules like `ta.momentum`, `ta.trend`, `ta.volatility`, etc.

This quickstart demonstrates how to load a DataFrame with typical OHLCV (Open, High, Low, Close, Volume) data, clean potential NaN values, and then apply all available technical analysis features using `add_all_ta_features`. The resulting DataFrame will include numerous new columns corresponding to various indicators.

import pandas as pd from ta import add_all_ta_features from ta.utils import dropna # Example DataFrame (replace with your actual data) data = { 'Open': [100, 102, 101, 105, 103, 106, 108, 107, 109, 110], 'High': [103, 104, 105, 106, 107, 108, 110, 110, 112, 113], 'Low': [98, 100, 99, 102, 100, 103, 105, 104, 106, 107], 'Close': [102, 101, 104, 103, 106, 107, 109, 108, 111, 112], 'Volume': [1000, 1200, 1100, 1500, 1300, 1400, 1600, 1550, 1700, 1800] } df = pd.DataFrame(data) # Ensure data has required columns (Open, High, Low, Close, Volume) # Clean NaN values (optional, but recommended if your data has them) df_cleaned = dropna(df) # Add all technical analysis features df_features = add_all_ta_features( df_cleaned, open="Open", high="High", low="Low", close="Close", volume="Volume" ) print(df_features.head())
Debug
Known issues
gotchaThis library (`ta` by bukobasabino) is *not* the `TA-Lib` Python wrapper (which uses `import talib`). Despite similar names and functionality, they are distinct projects with different APIs and installation requirements. This `ta` library is pure Python and easier to install, while `TA-Lib` is a Cython wrapper around a C library.
fix
Be clear about which library you intend to use. If you need the `TA-Lib` wrapper for performance or specific `TA-Lib` functions, install `TA-Lib` (often `pip install TA-Lib` after installing the C library). If you prefer a pure Python solution, use this `ta` library.
affects: All versions
gotchaThe library expects financial time series data with 'Open', 'High', 'Low', 'Close', and 'Volume' columns. Many indicators will produce NaN values for an initial 'lookback' period. It is crucial to handle or clean NaN values in your input DataFrame, either by using `ta.utils.dropna` or other Pandas methods, before applying indicators.
fix
Always preprocess your DataFrame to handle missing data before passing it to `ta` functions. Use `df = ta.utils.dropna(df)` or `df = df.dropna()` as appropriate.
affects: All versions
gotchaWhile the `ta` library is robust, for extremely large datasets or highly performance-critical real-time applications, the `TA-Lib` Python wrapper (often imported as `talib`) may offer superior performance due to its C-compiled core. The `ta` library prioritizes ease of installation and pure Python implementation.
fix
Evaluate your project's performance requirements. If absolute speed is paramount and you are comfortable with the more complex installation of the underlying C `TA-Lib` library, consider using `TA-Lib` (the wrapper) instead of `ta`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ta'
The `ta` library is not installed in the current Python environment or is not accessible on the Python path.
fix
Install the library using pip: `pip install ta`
KeyError: 'high'
The input DataFrame is missing one or more required column names ('open', 'high', 'low', 'close', 'volume') expected by `ta` functions like `add_all_ta_features`.
fix
Ensure your DataFrame columns are correctly named (case-sensitive) or rename them to match the expected lowercase format before passing to `ta` functions. Example: `df.rename(columns={'Open': 'open', 'High': 'high', 'Low': 'low', 'Close': 'close', 'Volume': 'volume'}, inplace=True)`
TypeError: missing 1 required positional argument: 'close'
An individual `ta` indicator function was called without providing the necessary pandas Series as a keyword argument (e.g., `close=df['close']`).
fix
Pass the required pandas Series to the indicator function using the correct keyword argument. Example: `ta.momentum.rsi(close=df['close'], window=14, fillna=True)`
TypeError: 'module' object is not callable
The `ta` module itself was attempted to be called as a function, rather than accessing its specific attributes (functions, submodules, or classes).
fix
Access specific functions or attributes from the `ta` module. For example, use `ta.add_all_ta_features(...)` or `ta.volatility.bollinger_hband(...)` instead of `ta(...)`.
Upgrade
Version history
0.11.0latest on PyPI · released Nov 2, 2023
Audit
Dependencies
pandasrequiredCore data structure for time series processing and integration.
numpyrequiredNumerical operations and array handling, underlying dependency for pandas.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
ta — pip install ta · libregistry