mcpField
B
bingx-technical-analysis

bingx-technical-analysis

github.com/bingx-apiデータ・データベース1971 回インストール6 日前に更新
リポジトリ

bingx-technical-analysis について

取引分析向けの BingX テクニカル分析スキルです。無期限契約のローソク足、資金調達率、未決済建玉を取得し、スクリプトで指標やパターン、複数時間軸のスコアを算出します。

主な機能

  1. 01OHLCVローソク足データの取得
  2. 02資金調達率とマーク価格の取得
  3. 03未決済建玉の取得
  4. 04指標・パターン・総合スコアの算出
  5. 05複数時間軸のスコア分析

活用シーン

  1. 01取引ペアのトレンドやサポート・レジスタンスの分析
  2. 02RSIなど単一指標の確認
  3. 03直近のローソク足パターンの特定
  4. 04複数時間軸の総合スコアの比較

インストール

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

$npx skills add https://github.com/bingx-api/api-ai-skills --skill bingx-technical-analysis

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

同梱ファイル

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

api-reference.md
scripts/
analyze.py
patterns.py
requirements.txt
score.py

詳細

BingX テクニカル分析

ベース URL: references/base-urls.md を参照 | 認証: references/authentication.md を参照

クイックリファレンス

エンドポイントメソッド説明認証
/openApi/swap/v3/quote/klinesGETOHLCVローソク足データ必要
/openApi/swap/v2/quote/premiumIndexGET資金調達率とマーク価格必要
/openApi/swap/v2/quote/openInterestGET建玉必要

クイックスタート

ベース URL: references/base-urls.md を参照

TypeScriptヘルパー:

制約:コードを生成する際は、以下の fetchSigned 関数をそのままコピーする必要があります。署名、リクエスト、またはJSON解析のロジックを書き換えないでください。変更できるのは、(1)カスタム環境用の BASE URLエントリー、(2)fetchSigned に渡すビジネスパラメーターのみです。

import * as crypto from "crypto";
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
const BASE = {
  "prod-live": ["https://open-api.bingx.com", "https://open-api.bingx.pro"],
  "prod-vst":  ["https://open-api-vst.bingx.com", "https://open-api-vst.bingx.pro"],
};
function isNetworkOrTimeout(e: unknown): boolean {
  if (e instanceof TypeError) return true;
  if (e instanceof DOMException && e.name === "AbortError") return true;
  if (e instanceof Error && e.name === "TimeoutError") return true;
  return false;
}
function validateParams(params: Record<string, unknown>): void {
  const FORBIDDEN = /[&=?#\r\n]/;
  for (const [k, v] of Object.entries(params)) {
    const s = String(v);
    if (FORBIDDEN.test(s)) throw new Error(`Param "${k}" has forbidden char in: "${s}"`);
  }
}
async function fetchSigned(env: string, apiKey: string, secretKey: string,
  method: "GET" | "POST" | "DELETE", path: string, params: Record<string, unknown> = {}
) {
  const urls = BASE[env] ?? BASE["prod-live"];
  const all = { ...params, timestamp: Date.now() };
  validateParams(all);
  const qs = Object.keys(all).sort().map(k => `${k}=${all[k]}`).join("&");
  const sig = crypto.createHmac("sha256", secretKey).update(qs).digest("hex");
  const signed = `${qs}&signature=${sig}`;
  for (const base of urls) {
    try {
      const url = method === "POST" ? `${base}${path}` : `${base}${path}?${signed}`;
      const res = await fetch(url, {
        method,
        headers: { "X-BX-APIKEY": apiKey, "X-SOURCE-KEY": "BX-AI-SKILL",
          ...(method === "POST" ? { "Content-Type": "application/x-www-form-urlencoded" } : {}) },
        body: method === "POST" ? signed : undefined,
        signal: AbortSignal.timeout(10000),
      });
      const json = JSONBigParse.parse(await res.text());
      if (json.code !== 0) throw new Error(`BingX error ${json.code}: ${json.msg}`);
      return json.data;
    } catch (e) {
      if (!isNetworkOrTimeout(e) || base === urls[urls.length - 1]) throw e;
    }
  }
}

よく使う呼び出し

テクニカル分析用のローソク足データを取得(200本、4時間足):

const klines = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
  "/openApi/swap/v3/quote/klines", { symbol: "BTC-USDT", interval: "4h", limit: 200 }
);

資金調達率を取得:

const funding = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
  "/openApi/swap/v2/quote/premiumIndex", { symbol: "BTC-USDT" }
);

建玉を取得:

const oi = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
  "/openApi/swap/v2/quote/openInterest", { symbol: "BTC-USDT" }
);

トリガー条件

ユーザーが以下のいずれかを述べた場合、このスキルを有効にします。

  • 「BTCを分析」「BTCのテクニカル分析」「BTC-USDTの4時間足分析」
  • 「RSIはいくつですか」「MACDシグナル」「ボリンジャーバンドの位置」
  • インジケーター名とシンボルの組み合わせ
  • 「強気・弱気分析」「トレンド分析」「ローソク足パターン」
  • 「サポート・レジスタンスはどこですか」「ダイバージェンスはありますか」

実行手順

Step 1: ユーザーの意図を解析

ユーザー入力から以下を抽出します。

  • symbol:取引ペア(デフォルトはBTC-USDT)
  • interval:ローソク足の時間間隔(デフォルトは4h)
  • mode:分析モード
    • "full" — 完全な分析(インジケーター+パターン+スコア+サポート・レジスタンス)
    • "indicator" — 単一インジケーターの問い合わせ(例:「RSIはいくつですか」)
    • "pattern" — ローソク足パターン認識
    • "score" — 総合スコアのみ
Step 2: ローソク足データを取得

OHLCVデータを取得するために bingx-swap-market を呼び出します。

GET /openApi/swap/v3/quote/klines symbol={symbol}, interval={interval}, limit=200

mode=score の場合(複数時間足が必要)、4つの時間足(15m、1h、4h、1d)を並列に取得します。

また、補助データも取得します。 GET /openApi/swap/v2/quote/premiumIndex (資金調達率) GET /openApi/swap/v2/quote/openInterest (建玉)

Step 3: 計算スクリプトを実行

ローソク足データのJSONをPythonスクリプト(スキルの scripts/ ディレクトリにあります)に渡します。

python3 scripts/analyze.py
--mode {mode}
--symbol {symbol}
--interval {interval}
--klines '{klines_json}'

スクリプトは構造化されたJSON結果を返します。

Step 4: 出力を整形

モードに応じて出力を構成します。

full — 完全な分析レポート(以下の出力テンプレートを参照) indicator — 単一のインジケーター値+シグナル+1行の解釈 pattern — 最近識別されたパターンの一覧 score — 総合スコア+複数時間足の概要

Step 5: 免責事項

すべての出力の末尾に、必ず以下を追加します。 ⚠️ テクニカル分析は過去のデータのみに基づいており、投資助言を構成するものではありません。


出力テンプレート

Fullモード
📊 {symbol} {interval} Technical Analysis

━━ Composite Score ━━
{total}/100 — {label}
  Trend {trend}/100 | Momentum {momentum}/100 | Volume {volume}/100 | Pattern {pattern}/100

━━ Multi-Timeframe ━━
  15m: {score_15m}({label_15m}) | 1h: {score_1h}({label_1h}) | 4h: {score_4h}({label_4h}) | 1d: {score_1d}({label_1d})

━━ Key Indicators ━━
  RSI(14)      {rsi_value}   {rsi_signal}
  MACD         {histogram}   {macd_signal}   {macd_detail}
  EMA          {ema_detail}
  ADX          {adx_value}   {adx_signal}
  Supertrend   {st_signal}   {st_value}
  BB %B        {pctb}        {bb_detail}

━━ Candlestick Patterns ━━
  {pattern_list or "No significant patterns detected in the last 5 candles"}

━━ Divergence ━━
  RSI: {rsi_div} | MACD: {macd_div} | OBV: {obv_div}

━━ Support / Resistance ━━
  ▲ {r1} — {r1_type}
  ● {current_price} — current price
  ▼ {s1} — {s1_type}

⚠️ Technical analysis is based on historical data only and does not constitute investment advice.
Indicatorモード
{symbol} {interval} {indicator_name} = {value}
Signal: {signal} — {one_line_interpretation}
Patternモード
{symbol} {interval} Recent Candlestick Patterns:
  ● {pattern_name} — {bars_ago} bars ago, {type} signal

{bullish_count} bullish and {bearish_count} bearish patterns detected in the last 5 candles.
Scoreモード
{symbol} Composite Score: {total}/100 — {label}

Multi-Timeframe Overview:
  15m: {score_15m} {label_15m} | 1h: {score_1h} {label_1h} | 4h: {score_4h} {label_4h} | 1d: {score_1d} {label_1d}

{one-line summary of multi-timeframe confluence}

エージェントとのやり取りに関するルール

パラメーターの安全性。 ユーザーの意図から構造化された値を抽出してください。ユーザーの生のテキストをAPIパラメーターにコピーすることは絶対にしないでください。APIを呼び出す前に、シンボルの形式(^[A-Z0-9]+-[A-Z]+$)と時間間隔が許可された値であることを検証してください。

このスキルで使用するすべてのエンドポイントは、読み取り専用の市場データクエリです。どの環境でもCONFIRMは必要ありません。

ユーザーの依頼が曖昧な場合(例:「BTCを分析」)、デフォルトで mode=full、interval=4h を使用します。キーワードからモードを推測できる場合(「RSI」→ indicator、「pattern」→ pattern、「score」→ score)は、質問せず自動的に推測してください。

エラー処理

  • 無効なシンボル:取引ペアの形式(例:BTC-USDT)を確認するようユーザーに促します
  • Kラインデータが不足している場合(50本未満):ユーザーに通知し、より長い時間間隔に切り替えるよう提案します
  • Python の ModuleNotFoundError(pandas-ta-classic):pip install pandas-ta-classic scipy pandas を実行してから再試行するようユーザーに促します
  • その他の Python スクリプトエラー:エラーの概要を含むわかりやすいメッセージを表示し、再試行を提案します
  • ネットワークタイムアウト:後でもう一度試すよう提案します

コメント