ta-lib
C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib
By agiprolabs · 389 installs
npx skills add agiprolabs/claude-trading-skills --skill ta-lib
Source repository · Upstream listing
ta lib — C Optimized Technical Analysis
TA Lib (Technical Analysis Library) is a C library with a Python wrapper providing 150+ technical analysis functions and 61 candlestick pattern recognition functions. It is the industry standard for performance critical indicator computation, used in production trading systems where pandas ta or pure Python alternatives are too slow.
What TA Lib Is
TA Lib was originally written in C for financial market data analysis. The Python wrapper ( TA Lib on PyPI, imported as talib ) provides:
150+ indicator functions across overlap, momentum, volume, volatility, cycle, and math categories
61 candlestick pattern recognition functions — the most comprehensive pattern library available
C speed computation — 10 100x faster than pure Python equivalents on large datasets
Two APIs : a function API (pass arrays directly) and an abstract API (pass dict of arrays)
NumPy native — all inputs and outputs are NumPy arrays
Installation
TA Lib requires the underlying C library to be installed first:
If the C library is not installed, import talib will fail with an ImportError . The scripts in this skill include fallback logic for environments without TA Lib installed.
When to Use TA Lib vs pandas ta
Criterion TA Lib pandas ta
Speed C optimized, 10 100x faster Pure Python, slower on large data
Candlestick patterns 61 built in patterns Limited pattern support
Installation Requires C library pip install only
API style NumPy arrays DataFrame .ta accessor
Indicator count 150+ 130+
Streaming Single value update possible Recompute entire series
Dependencies C lib + numpy pandas only
Use TA Lib when:
Processing millions of bars or running backtests at scale
You need candlestick pattern recognition (TA Lib is unmatched here)
You are building a production pipeline where latency matters
You need cycle indicators (Hilbert Transform family)
Use pandas ta when:
You want DataFrame native convenience
Installation simplicity matters (no C dependency)
You need indicators not in TA Lib (pandas ta has some extras)
Quick Start
Function API vs Abstract API
Function API (Recommended)
Call functions directly with NumPy arrays:
Abstract API
Pass a dictionary of arrays and get results by name:
The abstract API is useful for dynamic indicator selection (e.g., looping over a list of indicator names).
Function Groups
TA Lib organizes functions into these groups:
Overlap Studies
Moving averages and envelope indicators that overlay price charts.
Momentum Indicators
Oscillators and trend strength measures.
Volume Indicators
Volume based analysis functions.
Volatility Indicators
Measures of price variability.
Pattern Recognition (Candlestick)
61 functions that detect candlestick patterns. All return integer arrays:
+100 = bullish pattern detected
100 = bearish pattern detected
0 = no pattern
See references/candlestick patterns.md for the full list of 61 patterns with reliability ratings and crypto relevance.
Math Transform & Math Operators
Mathematical functions (sin, cos, ln, etc.) and operators (add, sub, mult, div) on arrays. Rarely used directly but available.
Crypto Considerations
24/7 Markets
Candlestick patterns designed for traditional markets with opening/closing gaps may behave differently on crypto's continuous markets
Gap based patterns (morning star, evening star) are less reliable without session gaps
Body ratio patterns (doji, hammer, engulfing) still work well on any timeframe
Timeframe Selection
1m 5m : Patterns are noisy; combine with volume confirmation
15m 1h : Good for intraday signals on high cap tokens
4h 1d : Most reliable for pattern recognition
Tip : Higher timeframes produce fewer but more reliable pattern signals
NaN Handling
TA Lib returns NaN for the initial lookback period of each indicator. Always account for this:
Solana Token Data
When using TA Lib with Solana token OHLCV data:
Ensure arrays are float64 dtype — TA Lib requires this
Sort by timestamp ascending before passing to TA Lib
Handle gaps in low liquidity token data before computing indicators
Integration with Other Skills
With pandas ta
pandas ta can use TA Lib as a backend when installed, getting C speed through the pandas ta API:
With vectorbt
vectorbt integrates with TA Lib for fast backtesting:
With Birdeye/DexScreener Data
Fetch OHLCV data from API skills, then process with TA Lib:
Listing Available Functions
Files
File Description
references/function reference.md Most useful functions by category with syntax and parameters
references/candlestick patterns.md All 61 candlestick patterns grouped by type with reliability ratings
scripts/compute indicators.py Computes common indicators with TA Lib/fallback comparison
scripts/pattern scanner.py Scans OHLCV data for all 61 candlestick patterns