indicator-expert について
OpenAlgo Indicator Expert Skillは、トレーダーや開発者向けにPythonでのテクニカル指標分析の手順を示します。OpenAlgo、yfinance、openalgo.taを使ったデータ処理、指標計算、チャート、ダッシュボードのパターンを扱います。
主な機能
- 01100種類以上のopenalgo.ta指標の利用
- 02OpenAlgoまたはyfinanceからの市場データ取得
- 03リアルタイムWebSocketフィードの処理
- 04Plotlyチャートとダッシュボードの作成
- 05NumPyによるカスタム指標の構成
- 06モジュール式ルールとテンプレートの参照
活用シーン
- 01市場データから指標チャートを作成
- 02銘柄や時間足ごとのダッシュボードを構築
- 03リアルタイムの気配値や板情報を配信
- 04カスタム指標の組み合わせを開発
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ marketcalls/ openalgo-indicator-skills --skill indicator-expertインストール後、Claude Code で/indicator-expertを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
rules/custom-indicators.mddashboard-patterns.mddata-fetching.mdindicator-catalog.mdindicator-combinations.mdmulti-timeframe.mdperformance.mdplotting.mdsignal-generation.mdstreamlit-patterns.mdsymbol-format.mdwebsocket-feeds.mdrules/assets/bollinger_chart/chart.pyrules/assets/custom_indicator/template.pyrules/assets/dashboard_basic/app.pyrules/assets/dashboard_multi/app.pyrules/assets/ema_chart/chart.pyrules/assets/live_feed/template.pyrules/assets/macd_chart/chart.pyrules/assets/multi_indicator/chart.pyrules/assets/rsi_chart/chart.pyrules/assets/scanner/template.pyrules/assets/streamlit_basic/app.pyrules/assets/streamlit_multi/app.pyrules/assets/supertrend_chart/chart.py詳細
OpenAlgo インジケーターエキスパートスキル
環境
- openalgo 2.x が必要とする Python 3.12 以降と、openalgo、pandas、numpy、plotly、dash、streamlit
- データソース:OpenAlgo(インド市場では
client.history()、client.quotes()、client.depth())、yfinance(米国/グローバル) - リアルタイム:OpenAlgo WebSocket(
client.connect()、subscribe_ltp、subscribe_quote、subscribe_depth) - インジケーター:openalgo.ta(必ず使用してください — コンパイル済み Rust コアによって 100 以上のインジケーターを計算し、初回からフルスピードで動作します)
- チャート:
template="plotly_dark"を指定した Plotly - ダッシュボード:Plotly Dash と
dash-bootstrap-components(デフォルト)、またはst.plotly_chart()を使用する Streamlit — Streamlit はユーザーが明示的に希望した場合のみ使用してください - カスタムインジケーター:openalgo.ta のプリミティブからベクトル化した NumPy を組み合わせて作成します(Rust コア — JIT もウォームアップも不要です)
- API キーは
python-dotenvとfind_dotenv()を使用し、ルートの単一の.envから読み込みます — キーをハードコードしないでください - スクリプトは適切なディレクトリ(charts/、dashboards/、custom_indicators/、scanners/)に配置します。ディレクトリは必要に応じて作成してください
- コードやロガー出力にアイコンや絵文字を使用しないでください
重要なルール
- すべてのテクニカルインジケーターには、必ず openalgo.ta を使用してください。 ライブラリにすでに存在する機能を再実装しないでください。
- データの正規化:データ取得後は、DataFrame のインデックスを必ず datetime に変換してソートし、タイムゾーンを除去してください。
- シグナルのクリーニング:生の買い/売りシグナルを生成した後は、必ず
ta.exrem()を使用してください。exrem の前に必ず.fillna(False)を適用してください。 - Plotly のダークテーマ:すべてのチャートで
template="plotly_dark"を使用し、ローソク足チャートではxaxis type="category"を設定してください。 - カスタムインジケーター:openalgo.ta のプリミティブ(
ta.sma、ta.stdev、ta.bbands、...)とベクトル化した NumPy を組み合わせて作成してください。組み込み機能を再実装しないでください。JIT やウォームアップは不要です。 - 入力の柔軟性:openalgo.ta は numpy 配列、pandas Series、リストを受け付けます。出力の型は入力の型と一致します。
- WebSocket フィード:リアルタイムデータには
client.connect()とclient.subscribe_ltp()/subscribe_quote()/subscribe_depth()を使用してください。 - 環境:
find_dotenv()を介してプロジェクトルートの.envを読み込んでください — API キーをハードコードしないでください。 - 市場の判定:銘柄がインド市場のものと思われる場合(SBIN、RELIANCE、NIFTY)は OpenAlgo を使用してください。米国市場のもの(AAPL、MSFT)には yfinance を使用してください。
- チャート出力の説明:トレーダーがインジケーターの内容を理解できるよう、チャートの出力を平易な言葉で必ず説明してください。
データソースの優先順位
| 市場 | データソース | メソッド | 銘柄の例 |
|---|---|---|---|
| インド(株式) | OpenAlgo | client.history() | SBIN、RELIANCE、INFY |
| インド(指数) | OpenAlgo | client.history(exchange="NSE_INDEX") | NIFTY、BANKNIFTY |
| インド(先物・オプション) | OpenAlgo | client.history(exchange="NFO") | NIFTY30DEC25FUT |
| 米国/グローバル | yfinance | yf.download() | AAPL、MSFT、SPY |
データ用 OpenAlgo API メソッド
| メソッド | 用途 | 戻り値 |
|---|---|---|
client.history(symbol, exchange, interval, start_date, end_date) | OHLCV ローソク足 | DataFrame(timestamp、open、high、low、close、volume) |
client.quotes(symbol, exchange) | リアルタイムスナップショット | Dict(open、high、low、ltp、bid、ask、prev_close、volume) |
client.multiquotes(symbols=[...]) | 複数銘柄のクオート | クオート辞書のリスト |
client.depth(symbol, exchange) | マーケットデプス(L5) | Dict(bids、asks、ohlc、volume、oi) |
client.intervals() | 利用可能な間隔 | Dict(minutes、hours、days、weeks、months) |
client.optionchain(underlying, exchange, expiry_date, strike_count) | ATM 付近のオプションチェーン | Dict(underlying_ltp、atm_strike、各 strike の ce/pe を含む chain) |
client.optiongreeks(symbol, exchange, interest_rate, ...) | オプションのグリークスと IV | Dict(greeks:delta/gamma/theta/vega/rho、implied_volatility、days_to_expiry) |
client.expiry(symbol, exchange, instrumenttype) | 満期日の一覧 | Dict(data:満期日のリスト) |
client.connect() | WebSocket 接続 | None(WS 接続を設定します) |
client.subscribe_ltp(instruments, callback) | ライブ LTP ストリーム | {symbol, exchange, ltp} を含むコールバック |
client.subscribe_quote(instruments, callback) | ライブクオートストリーム | {symbol, exchange, ohlc, ltp, volume} を含むコールバック |
client.subscribe_depth(instruments, callback) | ライブデプスストリーム | {symbol, exchange, bids, asks} を含むコールバック |
インジケーターライブラリのリファレンス
すべてのインジケーターには from openalgo import ta からアクセスします。
トレンド(20)
ta.sma、ta.ema、ta.wma、ta.dema、ta.tema、ta.hma、ta.vwma、ta.alma、ta.kama、ta.zlema、ta.t3、ta.frama、ta.supertrend、ta.ichimoku、ta.chande_kroll_stop、ta.trima、ta.mcginley、ta.vidya、ta.alligator、ta.ma_envelopes
モメンタム(9)
ta.rsi、ta.macd、ta.stochastic、ta.cci、ta.williams_r、ta.bop、ta.elder_ray、ta.fisher、ta.crsi
ボラティリティ(16)
ta.atr、ta.bbands、ta.keltner、ta.donchian、ta.chaikin_volatility、ta.natr、ta.rvi、ta.ultimate_oscillator、ta.true_range、ta.massindex、ta.bb_percent、ta.bb_width、ta.chandelier_exit、ta.historical_volatility、ta.ulcer_index、ta.starc
出来高(15)
ta.obv、ta.obv_smoothed、ta.vwap、ta.mfi、ta.adl、ta.cmf、ta.emv、ta.force_index、ta.nvi、ta.pvi、ta.volosc、ta.vroc、ta.kvo、ta.pvt、ta.rvol
オシレーター(20+)
ta.cmo、ta.trix、ta.uo_oscillator、ta.awesome_oscillator、ta.accelerator_oscillator、ta.ppo、ta.po、ta.dpo、ta.aroon_oscillator、ta.stoch_rsi、ta.rvi_oscillator、ta.cho、ta.chop、ta.kst、ta.tsi、ta.vortex、ta.gator_oscillator、ta.stc、ta.coppock、ta.roc
統計(9)
ta.linreg、ta.lrslope、ta.correlation、ta.beta、ta.variance、ta.tsf、ta.median、ta.mode、ta.median_bands
ハイブリッド(6+)
ta.adx、ta.dmi、ta.aroon、ta.pivot_points、ta.sar、ta.williams_fractals、ta.rwi
TA-Lib 互換(18、openalgo 2.0 で追加)
ta.mom、ta.rocp、ta.rocr、ta.rocr100、ta.apo、ta.midpoint、ta.midprice、ta.avgprice、ta.medprice、ta.typprice、ta.wclprice、ta.plus_dm、ta.minus_dm、ta.dx、ta.adxr、ta.stochf、ta.linregangle、ta.linregintercept
ユーティリティ
ta.crossover、ta.crossunder、ta.cross、ta.highest、ta.lowest、ta.change、ta.roc、ta.stdev、ta.exrem、ta.flip、ta.valuewhen、ta.rising、ta.falling
モジュール式ルールファイル
各トピックの詳細なリファレンスは rules/ にあります。
| ルールファイル | トピック |
|---|---|
| indicator-catalog | シグネチャとパラメーターを含む、100 種類以上のインジケーターの完全なリファレンス |
| data-fetching | OpenAlgo の履歴データ/クォート/板情報、yfinance、データの正規化 |
| plotting | Plotly のローソク足、オーバーレイ、サブプロット、複数パネルのチャート |
| custom-indicators | ベクトル化された NumPy と ta プリミティブを使用したカスタムインジケーターの構築 |
| websocket-feeds | WebSocket によるリアルタイムの LTP/クォート/板情報のストリーミング |
| performance | Rust コアのパフォーマンス、O(n) の保証、ベンチマーク |
| dashboard-patterns | コールバックを使用した Plotly Dash ウェブアプリケーション |
| streamlit-patterns | サイドバー、メトリクス、Plotly チャートを備えた Streamlit ウェブアプリケーション |
| multi-timeframe | 複数時間足のインジケーター分析 |
| signal-generation | シグナルの生成、クリーニング、クロスオーバー/クロスアンダー |
| indicator-combinations | コンフルエンス分析のためのインジケーターの組み合わせ |
| symbol-format | OpenAlgo のシンボル形式、取引所コード、インデックスシンボル |
チャートテンプレート(rules/assets/ 内)
| テンプレート | パス | 説明 |
|---|---|---|
| EMA チャート | assets/ema_chart/chart.py | ローソク足への EMA オーバーレイ |
| RSI チャート | assets/rsi_chart/chart.py | 買われすぎ/売られすぎゾーンを示す RSI |
| MACD チャート | assets/macd_chart/chart.py | MACD ライン、シグナル、ヒストグラム |
| Supertrend | assets/supertrend_chart/chart.py | 方向に応じた色分けを備えた Supertrend オーバーレイ |
| ボリンジャー | assets/bollinger_chart/chart.py | スクイーズ検出機能付きボリンジャーバンド |
| 複数インジケーター | assets/multi_indicator/chart.py | ローソク足 + EMA + RSI + MACD + 出来高 |
| 基本ダッシュボード | assets/dashboard_basic/app.py | 単一シンボルの Plotly Dash アプリ |
| 複数ダッシュボード | assets/dashboard_multi/app.py | 複数シンボル・複数時間足のダッシュボード |
| Streamlit 基本 | assets/streamlit_basic/app.py | 単一シンボルの Streamlit アプリ |
| Streamlit 複数 | assets/streamlit_multi/app.py | 複数時間足の Streamlit アプリ |
| カスタムインジケーター | assets/custom_indicator/template.py | NumPy カスタムインジケーターのテンプレート(ta プリミティブを組み合わせます) |
| ライブフィード | assets/live_feed/template.py | WebSocket リアルタイムインジケーター |
| スキャナー | assets/scanner/template.py | 複数シンボルのインジケータースキャナー |
クイックテンプレート:標準的なインジケーターチャートスクリプト
import os
from datetime import datetime, timedelta
from pathlib import Path
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from dotenv import find_dotenv, load_dotenv
from openalgo import api, ta
# --- Config ---
script_dir = Path(__file__).resolve().parent
load_dotenv(find_dotenv(), override=False)
SYMBOL = "SBIN"
EXCHANGE = "NSE"
INTERVAL = "D"
# --- Fetch Data ---
client = api(
api_key=os.getenv("OPENALGO_API_KEY"),
host=os.getenv("OPENALGO_HOST", "http://127.0.0.1:5000"),
)
end_date = datetime.now().date()
start_date = end_date - timedelta(days=365)
df = client.history(
symbol=SYMBOL, exchange=EXCHANGE, interval=INTERVAL,
start_date=start_date.strftime("%Y-%m-%d"),
end_date=end_date.strftime("%Y-%m-%d"),
)
if "timestamp" in df.columns:
df["timestamp"] = pd.to_datetime(df["timestamp"])
df = df.set_index("timestamp")
else:
df.index = pd.to_datetime(df.index)
df = df.sort_index()
if df.index.tz is not None:
df.index = df.index.tz_convert(None)
close = df["close"]
high = df["high"]
low = df["low"]
volume = df["volume"]
# --- Compute Indicators ---
ema_20 = ta.ema(close, 20)
rsi_14 = ta.rsi(close, 14)
# --- Chart ---
fig = make_subplots(
rows=2, cols=1, shared_xaxes=True,
row_heights=[0.7, 0.3], vertical_spacing=0.03,
subplot_titles=[f"{SYMBOL} Price + EMA(20)", "RSI(14)"],
)
# Candlestick
x_labels = df.index.strftime("%Y-%m-%d")
fig.add_trace(go.Candlestick(
x=x_labels, open=df["open"], high=high, low=low, close=close,
name="Price",
), row=1, col=1)
# EMA overlay
fig.add_trace(go.Scatter(
x=x_labels, y=ema_20, mode="lines",
name="EMA(20)", line=dict(color="cyan", width=1.5),
), row=1, col=1)
# RSI subplot
fig.add_trace(go.Scatter(
x=x_labels, y=rsi_14, mode="lines",
name="RSI(14)", line=dict(color="yellow", width=1.5),
), row=2, col=1)
fig.add_hline(y=70, line_dash="dash", line_color="red", row=2, col=1)
fig.add_hline(y=30, line_dash="dash", line_color="green", row=2, col=1)
fig.update_layout(
template="plotly_dark", title=f"{SYMBOL} Technical Analysis",
xaxis_rangeslider_visible=False, xaxis_type="category",
xaxis2_type="category", height=700,
)
fig.show()