gitmyhub

ta-lib-python

Cython ★ 12k updated 3mo ago

Python wrapper for TA-Lib (http://ta-lib.org/).

TA-Lib for Python is a fast Cython wrapper that gives Python and Pandas users access to over 150 financial technical analysis indicators, MACD, RSI, Bollinger Bands, candlestick patterns, running 2-4x faster than the original bindings.

PythonCythonCPandasPolarssetup: moderatecomplexity 3/5

TA-Lib for Python is a wrapper that makes a well-known financial analysis library, TA-Lib, available from Python code. TA-Lib is a C library that traders and quantitative developers use to calculate technical indicators from price data. Things like MACD, RSI, Bollinger Bands, and the Stochastic oscillator are all in there, along with over 150 other indicators and a set of candlestick pattern recognition functions. This Python package gives you access to all of that from a Python script or notebook.

The wrapper is built with Cython rather than the older SWIG binding approach that TA-Lib once used officially. The practical difference is that this version is easier to install and runs the calculations two to four times faster than the original Python bindings. It also works with Pandas DataFrames and Polars DataFrames, which are the data structures most Python data analysts already use.

Installation has two parts. First, you need to install the underlying TA-Lib C library on your operating system. On a Mac this is one Homebrew command; on Windows there is an installer package; on Linux you download and compile from source. After that, you install the Python wrapper with pip. The README covers common error messages that appear when the C library is not found and explains how to point the installer at a custom installation location using environment variables.

Starting with version 0.6.5, the project publishes pre-built binary wheels for many platform and Python version combinations, including Linux, macOS, and Windows on both x86 and ARM processors. If a matching wheel is available for your setup, installation skips the compile step entirely.

The project tracks three parallel version branches because the upstream C library changed its name in version 0.6 and that change affected how the Python wrapper links to it. The README explains which Python package version corresponds to which version of the underlying C library, so you can match them correctly.

Where it fits