mcpField
N
news-reaction-failure-analyzer

news-reaction-failure-analyzer

github.com/tradermontyその他3.4k2.6k 回インストール2 日前に更新
リポジトリ

news-reaction-failure-analyzer について

ポジションが偏った市場が、そのポジションに有利なニュースに反応しなかったかを調べるリサーチスキルです。整理済みのイベント情報と価格データで逆張り条件を評価し、その後の値動き確認や取引判断は手動で行います。

主な機能

  1. 01検出レポートまたは明示入力から方向を取得
  2. 02整理済みニュースイベントと価格反応を分析
  3. 03単純な反応比率でなくドリフトの有意性を検定
  4. 04重複するイベント期間を考慮
  5. 05根拠と除外項目を含む判定を出力

活用シーン

  1. 01関連ニュース後のポジション偏りを確認
  2. 02Shapiro流逆張りプロセスのニュース段階を評価
  3. 03イベントごとの反応と除外根拠を確認

インストール

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

$npx skills add https://github.com/tradermonty/claude-trading-skills --skill news-reaction-failure-analyzer

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

同梱ファイル

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

requirements.txt
references/
news-failure-patterns.md
price-source-map.md
scripts/
analyze_news_reaction.py
reaction_math.py
scripts/tests/
test_analyze_news_reaction.py
test_reaction_math.py

詳細

News Reaction Failure Analyzer

Overview

Implements step 2 of Jason Shapiro's COT contrarian process: once a market is flagged as crowded (cot-contrarian-detector, step 1), check whether it FAILED to react to news that should have rewarded the crowd. A crowded-long market that doesn't rally on genuinely bullish news, or a crowded-short market that doesn't sell off on genuinely bearish news, is the core behavioral tell that the crowd has run out of buying/selling power — this is the confirmation step that turns "crowded" into a contrarian setup candidate (steps 3-5, still manual: price-action confirmation, entry, exit).

Why this isn't a naive failure-ratio check: an earlier design flagged "news failure" whenever fewer than half the relevant events "responded" — but under pure noise, roughly 69% of individual events fail to respond by chance, so that rule would CONFIRM on random noise 48-83% of the time depending on sample size. This skill instead requires the market to have moved significantly against the crowd's favorable news (a drift- significance test with a Monte-Carlo-verified null false-positive bound), never merely "didn't respond enough." See references/news-failure-patterns.md for the full statistical rationale.

When to Use This Skill

English:

  • "Did the market shrug off [event] even though [asset] is crowded long/short?"
  • "Run a news-failure check on [symbol]"
  • "Is [symbol] confirmed for a Shapiro-style contrarian setup?"
  • After cot-contrarian-detector flags a market CROWDED_LONG / CROWDED_SHORT and the user wants to move to step 2

Japanese:

  • 「この市場は好材料に反応しなかった?」
  • 「COTで偏っているこの銘柄のニュース失敗を確認して」

Do NOT use when:

  • The market isn't crowded (NEUTRAL classification) — this skill refuses fail-closed without an explicit --direction override
  • No curated events JSON exists yet — WebSearch must run first (Phase 2 below); never fabricate events or URLs to get a verdict

Prerequisites

  • FMP API Key: Required. Set FMP_API_KEY or pass --api-key. Used for price data only (stable/historical-price-eod/light) — coverage varies by symbol; see references/price-source-map.md.
  • Python 3.9+ with requests installed.
  • WebSearch access to curate the events JSON (Phase 2). Skill degrades gracefully without it (states the limitation; never fabricates events).
  • Optional: a cot-contrarian-detector JSON report (--detector-json) to auto-resolve symbol + direction, or supply --direction explicitly.

Workflow

Phase 1: Obtain symbol + direction

From a cot-contrarian-detector report (--detector-json, symbol looked up in markets[]) or directly from the user (--symbol + --direction). A NEUTRAL classification, a symbol missing from the report, or a report older than --max-detector-age-days (default 10) all refuse fail-closed with a specific reason — only an explicit --direction overrides.

Phase 2: Curate the events JSON via WebSearch

Search news in the evaluation window (--window-days, default 10) using the 4-tier source hierarchy (issuer/primary → SEC/official stats → wire → portal — see references/news-failure-patterns.md). Write findings into an events JSON from references/news-failure-patterns.md's template — event, event_time (ISO8601 with explicit UTC offset), source_url, source_tier, expected_impact (BULLISH/BEARISH) per event.

Never fabricate events or URLs. WebSearch unavailable → state it explicitly; proceed without an events JSON only if the user accepts an INSUFFICIENT_EVIDENCE result (reason no_events_provided) — the CLI never raises an exception for a missing events file, it always exits 0 with a documented reason.

フェーズ 3:CLI を実行する
python3 skills/news-reaction-failure-analyzer/scripts/analyze_news_reaction.py \
  --symbol B6 --detector-json reports/cot_crowding_2026-07-12.json \
  --events-json reports/nrf_events_B6_2026-07-12.json \
  --output-dir reports/

スクリプトは価格系列を取得し(文書化されたフォールバック順序:先物シンボルを最初に使用し、402/アクセス制限、または rows == 0 の場合は ETF プロキシを使用します。references/price-source-map.md を参照)、イベントごとに有効日/リターン/z スコアを計算し、3 取引日のウィンドウが重複するイベントをクラスタリングして(独立性ガード)、判定を生成します。

フェーズ 4:判定と引き継ぎを提示する

判定、集計統計(drift_stat、responded_ratio)、証拠テーブル(イベントごとのリターン/z スコア/反応ラベルを含み、dropped_events がある場合は理由も表示し、決して黙って隠しません)を提示します。プロキシ(run_context.proxy_used)を使用した場合は、トラッキングエラーに関する注意を記載します。

contrarian-setup-gate(#241、未実装)向けの引き継ぎブロックを出力します。

{"news_failure": {"verdict": "CONFIRMED", "confidence": "HIGH", "report_path": "reports/nrf_B6_2026-07-12.json"}}

出力

  • JSON: reports/nrf_<symbol>_<as-of-date>.json — schema_version、 symbol、direction、expected_direction、actual_reaction (FAILED_TO_RALLY/FAILED_TO_SELL_OFF/RALLIED/SOLD_OFF/ MIXED_REACTION/NO_DATA)、verdict、confidence、 relevant_events_used、aggregate(mean_z3/drift_stat/responded_ratio)、 evidence[]、dropped_events[]、run_context。
  • Markdown: reports/nrf_<symbol>_<as-of-date>.md — 人が読みやすい 判定、集計統計、証拠テーブル、除外イベントのテーブル、プロキシに関する注意 (使用した場合)、方法論の脚注。

ガードレール

  • CONFIRMED は取引シグナルではありません。 これは 5 段階のうちステップ 2 を確認するものです。ポジションを取る前に、値動きによる確認(ステップ 3)、エントリー(ステップ 4)、エグジット(ステップ 5)を手動で行う必要があります。
  • INSUFFICIENT_EVIDENCE ではパイプラインを先に進めません。 使用可能な関連イベント クラスター が --min-events(既定値 3)未満の場合、検出器レポートがない場合、検出器のデータ時点(data_date)がない、解析できない、--as-of より後の日付、または --max-detector-age-days を超えて古い(期限切れ)場合、明示的なオーバーライドがないまま分類が NEUTRAL の場合、あるいは使用可能な価格ソースがない場合は、いずれもこの判定になります。不十分なデータに対してクラッシュしたり、無理に結論を出したりすることはありません。
  • COT の公表遅延。 COT データは読み込む時点で 3~9 日前のものです(cot-contrarian-detector を参照)。ニュース不発の証拠は、同日確認としてではなく、この文脈で読み取ってください。
  • 逆方向のイベントは参考情報に限られます。 証拠テーブルには表示されますが、判定からは除外されます(群衆の expected_direction と一致する expected_impact を持つイベントのみがカウントされます)。
  • プロキシベースの価格は明示し、隠しません。 ETF プロキシを使用した場合(run_context.proxy_used)、レポートにその旨を記載します。トラッキングエラー、経費による下落、ロール時期の違いがあるため、反応方向の判定は正確ではなく概算となります。
  • 極端な相関下では統計的リスクが残ります。 判定の帰無仮説における誤った CONFIRMED の割合は、独立同分布のノイズ下(<8%)と、現実的な残差相関ストレス下(AR(1) ρ=0.1、<10%)で厳密に検証されています。意図的に極端な相関ストレス(クラスター化されていないイベントウィンドウ間のラグ 1 相関 ρ=0.3。流動性の高い先物で実測される自己相関のおよそ 10 倍)では、測定された帰無仮説の割合は約 11~13% に上昇します。これは v1 において文書化された制限であり、明示されていない欠落ではありません。全データについては references/news-failure-patterns.md を参照してください。このストレス下でもより厳格な <10% の基準を望むユーザーは、--drift-z 1.75 を指定できます(ただし、ノイズだけでなく実際のニュース不発シグナルも一部見逃す可能性があります)。
  • 投資助言ではありません。 調査・教育目的に限ります。

リソース

references/news-failure-patterns.md

方法論の全容:関連イベントの条件、4 段階のソース階層、具体例、events-JSON のキュレーションガイドとテンプレート、判定しきい値の根拠(単純な比率ではなくドリフトの有意性を使う理由、モンテカルロ検証済みの帰無仮説の境界値)。

references/price-source-map.md

市場ごとの価格ソースのフォールバックチェーン、確認済み/402/0 行のステータス(実装時にライブプローブを実施)、ETF プロキシに関する注意点、および利用可能なソースがない市場(記録されている no_price_source のケース:VX、ZQ、HO、このキーでのすべての農産物)。

参照資料を読み込むタイミング
  • 初回利用時/手法の説明時: references/news-failure-patterns.md を読み込みます
  • 市場に判定結果がない理由(no_price_source)の説明時: references/price-source-map.md を読み込みます
  • 通常の実行時: CLI 自体には参照資料は不要です。フェーズ 2(イベントの選定)と、ユーザーへの結果説明には必要です

コメント