mcpField
M
market-breadth-analyzer

market-breadth-analyzer

github.com/mphinanceデータ・データベース3287 回インストール5 日前に更新
リポジトリ

market-breadth-analyzer について

market-breadth-analyzerは、市場の値動きにどれだけ多くの銘柄が参加しているかを評価する分析スキルです。公開CSVから6項目を採点し、APIキーなしで0~100のスコア、ゾーン分類、トレンド概要を作成します。

主な機能

  1. 016項目を0~100点で採点
  2. 02データの鮮度確認と古いデータの警告
  3. 03健全度ゾーンを株式エクスポージャーに対応
  4. 04スコア履歴の記録とトレンド算出
  5. 05JSONおよびMarkdownレポートの生成

活用シーン

  1. 01相場上昇が広範な銘柄に支えられているか確認
  2. 02市場参加の縮小を監視
  3. 03ブレッドスに基づく株式エクスポージャーの評価
  4. 04ブレッドススコアの経時変化を確認

インストール

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

$npx skills add https://github.com/mphinance/alpha-skills --skill market-breadth-analyzer

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

同梱ファイル

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

README.md
references/
breadth_analysis_methodology.md
scripts/
csv_client.py
history_tracker.py
market_breadth_analyzer.py
report_generator.py
scorer.py
scripts/calculators/
__init__.py
bearish_signal_calculator.py
cycle_calculator.py
divergence_calculator.py
historical_context_calculator.py
ma_crossover_calculator.py
trend_level_calculator.py
scripts/tests/
conftest.py
test_bearish_signal_calculator.py
test_cycle_calculator.py
test_divergence_calculator.py
test_historical_context_calculator.py
test_history_tracker.py
test_ma_crossover_calculator.py
test_report_generator.py
test_scorer.py
test_trend_level_calculator.py

詳細

Market Breadth Analyzer Skill

Purpose

Quantify market breadth health using a data-driven 6-component scoring system (0-100). Uses TraderMonty's publicly available CSV data to measure how broadly the market is participating in a rally or decline.

Score direction: 100 = Maximum health (broad participation), 0 = Critical weakness.

No API key required - uses freely available CSV data from GitHub Pages.

When to Use This Skill

English:

  • User asks "Is the market rally broad-based?" or "How healthy is market breadth?"
  • User wants to assess market participation rate
  • User asks about advance-decline indicators or breadth thrust
  • User wants to know if the market is narrowing (fewer stocks participating)
  • User asks about equity exposure levels based on breadth conditions

Japanese:

  • 「マーケットブレッドスはどうですか?」「市場の参加率は?」
  • 「上昇は広がっている?」「一部の銘柄だけの上昇?」
  • ブレッドス指標に基づくエクスポージャー判断
  • 市場の健康度をデータで確認したい

Prerequisites

  • Python 3.8+ with requests library (for fetching CSV data)
  • Internet access to reach GitHub Pages URLs
  • No API keys required - uses freely available public CSV data

Difference from Breadth Chart Analyst

AspectMarket Breadth AnalyzerBreadth Chart Analyst
Data SourceCSV (automated)Chart images (manual)
API RequiredNoneNone
OutputQuantitative 0-100 scoreQualitative chart analysis
Components6 scored dimensionsVisual pattern recognition
RepeatabilityFully reproducibleAnalyst-dependent

Execution Workflow

Phase 1: Execute Python Script

Run the analysis script:

python3 skills/market-breadth-analyzer/scripts/market_breadth_analyzer.py \
  --detail-url "https://tradermonty.github.io/market-breadth-analysis/market_breadth_data.csv" \
  --summary-url "https://tradermonty.github.io/market-breadth-analysis/market_breadth_summary.csv"

The script will:

  1. Fetch detail CSV (~2,500 rows, 2016-present) and summary CSV (8 metrics)
  2. Validate data freshness (warn if > 5 days old)
  3. Calculate all 6 component scores (with automatic weight redistribution if any component lacks data)
  4. Generate composite score with zone classification
  5. Track score history and compute trend (improving/deteriorating/stable)
  6. Output JSON and Markdown reports
Phase 2: Present Results

Present the generated Markdown report to the user, highlighting:

  • Composite score and health zone
  • Strongest and weakest components
  • Recommended equity exposure level
  • Key breadth levels to watch
  • Any data freshness warnings

6-Component Scoring System

#ComponentWeightKey Signal
1Breadth Level & Trend25%Current 8MA level + 200MA trend direction + 8MA direction modifier
28MA vs 200MA Crossover20%Momentum via MA gap and direction
3Peak/Trough Cycle20%Position in breadth cycle
4Bearish Signal15%Backtested bearish signal flag
5Historical Percentile10%Current vs full history distribution
6S&P 500 Divergence10%Multi-window (20d + 60d) price vs breadth divergence

Weight Redistribution: If any component lacks sufficient data (e.g., no peak/trough markers detected), it is excluded and its weight is proportionally redistributed among the remaining components. The report shows both original and effective weights.

Score History: Composite scores are persisted across runs (keyed by data date). The report includes a trend summary (improving/deteriorating/stable) when multiple observations are available.

Health Zone Mapping (100 = Healthy)

ScoreZoneEquity ExposureAction
80-100Strong90-100%Full position, growth/momentum favored
60-79Healthy75-90%Normal operations
40-59Neutral60-75%Selective positioning, tighten stops
20-39Weakening40-60%Profit-taking, raise cash
0-19Critical25-40%Capital preservation, watch for trough

データソース

詳細 CSV: market_breadth_data.csv

  • 2016-02 から現在までの約 2,500 行
  • 列: Date, S&P500_Price, Breadth_Index_Raw, Breadth_Index_200MA, Breadth_Index_8MA, Breadth_200MA_Trend, Bearish_Signal, Is_Peak, Is_Trough, Is_Trough_8MA_Below_04

サマリー CSV: market_breadth_summary.csv

  • 8 つの集計指標(平均ピーク、平均トラフ、件数、分析期間)

どちらも GitHub Pages で公開されており、認証は不要です。

出力ファイル

  • JSON: market_breadth_YYYY-MM-DD_HHMMSS.json
  • Markdown: market_breadth_YYYY-MM-DD_HHMMSS.md
  • 履歴: market_breadth_history.json(実行をまたいで保持され、最大 20 件)

参照ドキュメント

references/breadth_analysis_methodology.md
  • コンポーネントのスコアリング詳細を含む完全な方法論
  • しきい値の説明とゾーンの定義
  • 歴史的な背景と解釈ガイド
参照を読み込むタイミング
  • 初回使用時: フレームワークを理解するために方法論の参照を読み込みます
  • 通常の実行時: 参照は不要です - スクリプトがスコアリングを処理します

コメント