ta-lib
TA-Libライブラリを活用し、150種類以上のテクニカル指標と61種類のローソク足パターンを分析することで、株式や為替などの金融市場における投資判断を支援するSkill。
📜 元の英語説明(参考)
C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib
🇯🇵 日本人クリエイター向け解説
TA-Libライブラリを活用し、150種類以上のテクニカル指標と61種類のローソク足パターンを分析することで、株式や為替などの金融市場における投資判断を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o ta-lib.zip https://jpskill.com/download/10442.zip && unzip -o ta-lib.zip && rm ta-lib.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10442.zip -OutFile "$d\ta-lib.zip"; Expand-Archive "$d\ta-lib.zip" -DestinationPath $d -Force; ri "$d\ta-lib.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
ta-lib.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
ta-libフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
ta-lib — C で最適化されたテクニカル分析
TA-Lib (Technical Analysis Library) は、150 以上のテクニカル分析関数と 61 のローソク足パターン認識関数を提供する Python ラッパー付きの C ライブラリです。これは、pandas-ta や純粋な Python の代替手段では遅すぎる、本番環境の取引システムで使用される、パフォーマンスが重要な指標計算の業界標準です。
TA-Lib とは
TA-Lib は元々、金融市場データ分析のために C で記述されました。Python ラッパー (TA-Lib on PyPI、talib としてインポート) は以下を提供します。
- オーバーラップ、モメンタム、ボリューム、ボラティリティ、サイクル、および数学のカテゴリにわたる 150 以上の指標関数
- 61 のローソク足パターン認識関数 — 利用可能な最も包括的なパターンライブラリ
- C の速度での計算 — 大規模なデータセットでは、純粋な Python の同等物よりも 10〜100 倍高速
- 2 つの API: 関数 API (配列を直接渡す) と抽象 API (配列の dict を渡す)
- NumPy ネイティブ — すべての入力と出力は NumPy 配列です
インストール
TA-Lib をインストールするには、まず基盤となる C ライブラリをインストールする必要があります。
# 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
# ソースから (すべてのプラットフォーム)
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
C ライブラリがインストールされていない場合、import talib は ImportError で失敗します。このスキルのスクリプトには、TA-Lib がインストールされていない環境のためのフォールバックロジックが含まれています。
TA-Lib と pandas-ta の使い分け
| 基準 | TA-Lib | pandas-ta |
|---|---|---|
| 速度 | C で最適化、10〜100 倍高速 | 純粋な Python、大規模なデータでは遅い |
| ローソク足パターン | 61 の組み込みパターン | 限定的なパターンサポート |
| インストール | C ライブラリが必要 | pip install のみ |
| API スタイル | NumPy 配列 | DataFrame .ta アクセサー |
| 指標数 | 150+ | 130+ |
| ストリーミング | 単一の値の更新が可能 | シリーズ全体を再計算 |
| 依存関係 | C lib + numpy | pandas のみ |
TA-Lib は以下の場合に使用します:
- 数百万本のバーを処理したり、大規模なバックテストを実行したりする場合
- ローソク足パターン認識が必要な場合 (TA-Lib はここで比類なきものです)
- レイテンシが重要な本番環境のパイプラインを構築している場合
- サイクル指標 (Hilbert Transform ファミリー) が必要な場合
pandas-ta は以下の場合に使用します:
- DataFrame ネイティブの利便性が欲しい場合
- インストールの簡素さが重要な場合 (C の依存関係がない)
- TA-Lib にない指標が必要な場合 (pandas-ta にはいくつかの追加機能があります)
クイックスタート
import numpy as np
import talib
# サンプルデータを作成
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)
# 関数 API — 配列を直接渡す
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)
# ローソク足パターン — +100 (強気)、-100 (弱気)、または 0 を返す
doji = talib.CDLDOJI(open_, high, low, close)
hammer = talib.CDLHAMMER(open_, high, low, close)
engulfing = talib.CDLENGULFING(open_, high, low, close)
関数 API と抽象 API
関数 API (推奨)
NumPy 配列を使用して関数を直接呼び出します。
import talib
rsi = talib.RSI(close, timeperiod=14)
sma = talib.SMA(close, timeperiod=20)
upper, mid, lower = talib.BBANDS(close)
抽象 API
配列の辞書を渡し、名前で結果を取得します。
from talib import abstract
inputs = {"open": open_, "high": high, "low": low, "close": close, "volume": volume}
# 関数名で呼び出す
rsi = abstract.RSI(inputs, timeperiod=14)
macd = abstract.MACD(inputs) # (macd, signal, hist) を返す
抽象 API は、動的な指標選択 (たとえば、指標名のリストをループ処理する) に役立ちます。
関数グループ
TA-Lib は、関数を次のグループに編成します。
オーバーラップ指標
価格チャートに重ねて表示される移動平均とエンベロープ指標。
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)
モメンタム指標
オシレーターとトレンドの強さの指標。
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)
ボリューム指標
ボリュームベースの分析関数。
obv = talib.OBV(close, volume)
ad = talib.AD(high, low, close, volume)
adosc = talib.ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)
ボラティリティ指標
価格変動の尺度。
atr = talib.ATR(high, low, close, timeperiod=14)
natr = talib.NATR(high, low, close, timeperiod=14)
trange = talib.TRANGE(high, low, close)
パターン認識 (ローソク足)
ローソク足パターンを検出する 61 個の関数。すべて整数配列を返します。
+100= 強気パターンが検出されました-100= 弱気パターンが検出されました0= パターンなし
# 単一のパターン
doji = talib.CDLDOJI(open_, high, low, close)
hammer = talib.CDLHAMMER(open_, high, low, close)
engulfing = talib.CDLENGULFING(open_, high, low, close)
# 61 個のパターンすべてを一度にスキャン
candle_names = talib.get_function_groups()["Pattern Recognition"]
for name in candle_names:
func = getatt 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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:
# 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.
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
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)
Function API vs Abstract API
Function API (Recommended)
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)
Abstract API
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).
Function Groups
TA-Lib organizes functions into these groups:
Overlap Studies
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)
Momentum Indicators
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 Indicators
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)
Volatility Indicators
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)
Pattern Recognition (Candlestick)
61 functions that detect candlestick patterns. All return integer arrays:
+100= bullish pattern detected-100= bearish pattern detected0= no pattern
# Single patterns
doji = talib.CDLDOJI(open_, high, low, close)
hammer = talib.CDLHAMMER(open_, high, low, close)
engulfing = talib.CDLENGULFING(open_, high, low, close)
# Scan all 61 patterns at once
candle_names = talib.get_function_groups()["Pattern Recognition"]
for name in candle_names:
func = getattr(talib, name)
result = func(open_, high, low, close)
hits = np.nonzero(result)[0]
if len(hits) > 0:
print(f"{name}: {len(hits)} detections")
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:
rsi = talib.RSI(close, timeperiod=14)
# First 14 values will be NaN
valid_rsi = rsi[~np.isnan(rsi)]
Solana Token Data
When using TA-Lib with Solana token OHLCV data:
- Ensure arrays are
float64dtype — TA-Lib requires this - Sort by timestamp ascending before passing to TA-Lib
- Handle gaps in low-liquidity token data before computing indicators
# Convert to float64 for TA-Lib compatibility
close = df["close"].values.astype(np.float64)
high = df["high"].values.astype(np.float64)
low = df["low"].values.astype(np.float64)
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:
import pandas_ta as ta
# pandas-ta auto-detects TA-Lib and uses it for supported indicators
# Set explicitly:
ta.Imports["talib"] = True # Force TA-Lib backend
df.ta.rsi(length=14) # Uses TA-Lib under the hood if available
With vectorbt
vectorbt integrates with TA-Lib for fast backtesting:
import vectorbt as vbt
# Use TA-Lib indicators in vectorbt
rsi = vbt.talib("RSI").run(close, timeperiod=14)
entries = rsi.real_crossed_below(30)
exits = rsi.real_crossed_above(70)
With Birdeye/DexScreener Data
Fetch OHLCV data from API skills, then process with TA-Lib:
# After fetching OHLCV from birdeye-api or dexscreener-api
close = np.array(ohlcv_data["close"], dtype=np.float64)
rsi = talib.RSI(close, timeperiod=14)
Listing Available Functions
import talib
# All function groups
groups = talib.get_function_groups()
for group, funcs in groups.items():
print(f"{group}: {len(funcs)} functions")
# All function names
all_funcs = talib.get_functions()
print(f"Total: {len(all_funcs)} functions")
# Info about a specific function
info = talib.abstract.Function("RSI").info
print(info["display_name"], info["group"])
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 |