mcpField
I
indicator-expert

indicator-expert

github.com/marketcallsデータ・データベース20668 回インストール20 週間前に更新
リポジトリ

indicator-expert について

OpenAlgo Indicator Expert Skillは、トレーダーや開発者向けにPythonでのテクニカル指標分析の手順を示します。OpenAlgo、yfinance、openalgo.taを使ったデータ処理、指標計算、チャート、ダッシュボードのパターンを扱います。

主な機能

  1. 01100種類以上のopenalgo.ta指標の利用
  2. 02OpenAlgoまたはyfinanceからの市場データ取得
  3. 03リアルタイムWebSocketフィードの処理
  4. 04Plotlyチャートとダッシュボードの作成
  5. 05NumPyによるカスタム指標の構成
  6. 06モジュール式ルールとテンプレートの参照

活用シーン

  1. 01市場データから指標チャートを作成
  2. 02銘柄や時間足ごとのダッシュボードを構築
  3. 03リアルタイムの気配値や板情報を配信
  4. 04カスタム指標の組み合わせを開発

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/marketcalls/openalgo-indicator-skills --skill indicator-expert

インストール後、Claude Code で/indicator-expertを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

rules/
custom-indicators.md
dashboard-patterns.md
data-fetching.md
indicator-catalog.md
indicator-combinations.md
multi-timeframe.md
performance.md
plotting.md
signal-generation.md
streamlit-patterns.md
symbol-format.md
websocket-feeds.md
rules/assets/bollinger_chart/
chart.py
rules/assets/custom_indicator/
template.py
rules/assets/dashboard_basic/
app.py
rules/assets/dashboard_multi/
app.py
rules/assets/ema_chart/
chart.py
rules/assets/live_feed/
template.py
rules/assets/macd_chart/
chart.py
rules/assets/multi_indicator/
chart.py
rules/assets/rsi_chart/
chart.py
rules/assets/scanner/
template.py
rules/assets/streamlit_basic/
app.py
rules/assets/streamlit_multi/
app.py
rules/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/)に配置します。ディレクトリは必要に応じて作成してください
  • コードやロガー出力にアイコンや絵文字を使用しないでください

重要なルール

  1. すべてのテクニカルインジケーターには、必ず openalgo.ta を使用してください。 ライブラリにすでに存在する機能を再実装しないでください。
  2. データの正規化:データ取得後は、DataFrame のインデックスを必ず datetime に変換してソートし、タイムゾーンを除去してください。
  3. シグナルのクリーニング:生の買い/売りシグナルを生成した後は、必ず ta.exrem() を使用してください。exrem の前に必ず .fillna(False) を適用してください。
  4. Plotly のダークテーマ:すべてのチャートで template="plotly_dark" を使用し、ローソク足チャートでは xaxis type="category" を設定してください。
  5. カスタムインジケーター:openalgo.ta のプリミティブ(ta.sma、ta.stdev、ta.bbands、...)とベクトル化した NumPy を組み合わせて作成してください。組み込み機能を再実装しないでください。JIT やウォームアップは不要です。
  6. 入力の柔軟性:openalgo.ta は numpy 配列、pandas Series、リストを受け付けます。出力の型は入力の型と一致します。
  7. WebSocket フィード:リアルタイムデータには client.connect() と client.subscribe_ltp()/subscribe_quote()/subscribe_depth() を使用してください。
  8. 環境:find_dotenv() を介してプロジェクトルートの .env を読み込んでください — API キーをハードコードしないでください。
  9. 市場の判定:銘柄がインド市場のものと思われる場合(SBIN、RELIANCE、NIFTY)は OpenAlgo を使用してください。米国市場のもの(AAPL、MSFT)には yfinance を使用してください。
  10. チャート出力の説明:トレーダーがインジケーターの内容を理解できるよう、チャートの出力を平易な言葉で必ず説明してください。

データソースの優先順位

市場データソースメソッド銘柄の例
インド(株式)OpenAlgoclient.history()SBIN、RELIANCE、INFY
インド(指数)OpenAlgoclient.history(exchange="NSE_INDEX")NIFTY、BANKNIFTY
インド(先物・オプション)OpenAlgoclient.history(exchange="NFO")NIFTY30DEC25FUT
米国/グローバルyfinanceyf.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, ...)オプションのグリークスと IVDict(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-fetchingOpenAlgo の履歴データ/クォート/板情報、yfinance、データの正規化
plottingPlotly のローソク足、オーバーレイ、サブプロット、複数パネルのチャート
custom-indicatorsベクトル化された NumPy と ta プリミティブを使用したカスタムインジケーターの構築
websocket-feedsWebSocket によるリアルタイムの LTP/クォート/板情報のストリーミング
performanceRust コアのパフォーマンス、O(n) の保証、ベンチマーク
dashboard-patternsコールバックを使用した Plotly Dash ウェブアプリケーション
streamlit-patternsサイドバー、メトリクス、Plotly チャートを備えた Streamlit ウェブアプリケーション
multi-timeframe複数時間足のインジケーター分析
signal-generationシグナルの生成、クリーニング、クロスオーバー/クロスアンダー
indicator-combinationsコンフルエンス分析のためのインジケーターの組み合わせ
symbol-formatOpenAlgo のシンボル形式、取引所コード、インデックスシンボル

チャートテンプレート(rules/assets/ 内)

テンプレートパス説明
EMA チャートassets/ema_chart/chart.pyローソク足への EMA オーバーレイ
RSI チャートassets/rsi_chart/chart.py買われすぎ/売られすぎゾーンを示す RSI
MACD チャートassets/macd_chart/chart.pyMACD ライン、シグナル、ヒストグラム
Supertrendassets/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.pyNumPy カスタムインジケーターのテンプレート(ta プリミティブを組み合わせます)
ライブフィードassets/live_feed/template.pyWebSocket リアルタイムインジケーター
スキャナー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()

コメント