backtrader
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib
$ npx -y skills add agiprolabs/claude-trading-skills --skill ta-lib --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ta-libContext preview
The summary Claude sees to decide when to auto-load this skill.
C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib
name: ta-lib description: C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib
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.
TA-Lib was originally written in C for financial market data analysis. The Python wrapper (`TA-Lib` on PyPI, imported as `talib`) provides:
TA-Lib requires the underlying C library to be installed first:
# macOS brew install ta-lib uv pip install TA-Lib numpy pandas # Ubuntu/Debian sudo apt-get install -y ta-lib uv pip install TA-Lib numpy pandas # From source (any platform) wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-src.tar.gz tar -xzf ta-lib-0.6.4-src.tar.gz cd ta-lib-0.6.4 ./configure --prefix=/usr/local make && sudo make install uv pip install TA-Lib numpy pandas
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.
| 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:**
**Use pandas-ta when:**
import numpy as np import talib # Create sample data close = np.random.randn(100).cumsum() + 50 high = close + np.abs(np.random.randn(100)) low = close - np.abs(np.random.randn(100)) open_ = close + np.random.randn(100) * 0.5 volume = np.random.randint(1000, 10000, 100).astype(float) # Function API — pass arrays directly rsi = talib.RSI(close, timeperiod=14) macd, signal, hist = talib.MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) upper, middle, lower = talib.BBANDS(close, timeperiod=20, nbdevup=2, nbdevdn=2) atr = talib.ATR(high, low, close, timeperiod=14) # Candlestick patterns — return +100 (bullish), -100 (bearish), or 0 doji = talib.CDLDOJI(open_, high, low, close) hammer = talib.CDLHAMMER(open_, high, low, close) engulfing = talib.CDLENGULFING(open_, high, low, close)
Call functions directly with NumPy arrays:
import talib rsi = talib.RSI(close, timeperiod=14) sma = talib.SMA(close, timeperiod=20) upper, mid, lower = talib.BBANDS(close)
Pass a dictionary of arrays and get results by name:
from talib import abstract
inputs = {"open": open_, "high": high, "low": low, "close": close, "volume": volume}
# Call by function name
rsi = abstract.RSI(inputs, timeperiod=14)
macd = abstract.MACD(inputs) # returns (macd, signal, hist)The abstract API is useful for dynamic indicator selection (e.g., looping over a list of indicator names).
TA-Lib organizes functions into these groups:
Moving averages and envelope indicators that overlay price charts.
sma = talib.SMA(close, timeperiod=20) ema = talib.EMA(close, timeperiod=12) upper, mid, lower = talib.BBANDS(close, timeperiod=20, nbdevup=2, nbdevdn=2) sar = talib.SAR(high, low, acceleration=0.02, maximum=0.2) mama, fama = talib.MAMA(close, fastlimit=0.5, slowlimit=0.05)
Oscillators and trend-strength measures.
rsi = talib.RSI(close, timeperiod=14) macd, signal, hist = talib.MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) slowk, slowd = talib.STOCH(high, low, close) cci = talib.CCI(high, low, close, timeperiod=14) willr = talib.WILLR(high, low, close, timeperiod=14) adx = talib.ADX(high, low, close, timeperiod=14) mfi = talib.MFI(high, low, close, volume, timeperiod=14)
Volume-based analysis functions.
obv = talib.OBV(close, volume) ad = talib.AD(high, low, close, volume) adosc = talib.ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)
Measures of price variability.
atr = talib.ATR(high, low, close, timeperiod=14) natr = talib.NATR(high, low, close, timeperiod=14) trange = talib.TRANGE(high, low, close)
61 functions that detect candlestick patterns. All return integer arrays:
# Single patterns doji = talib.CDLDOJI(open_, high, low, close) hammer = talib.CDLHAMMER(open_, high, low, close) engulfing = talib.CDLENGULFING(open_, high, low, cl
A comprehensive collection of 68 ready-to-use trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools.
Repo: agiprolabs/claude-trading-skills
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security…
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats,…
Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability…
Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading
Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail…