news-reaction-failure-analyzer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

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.
实现Jason Shapiro的COT反向策略流程的第二步:一旦某市场被标记为拥挤状态(由
cot-contrarian-detector
工具的第一步流程识别),检查该市场是否未能对本应让拥挤头寸获利的新闻做出反应。拥挤多头市场未在真正利好的新闻下上涨,或拥挤空头市场未在真正利空的新闻下下跌,这是表明拥挤群体已耗尽买卖力量的核心行为信号——这一步确认流程将“拥挤状态”转化为反向交易候选机会(后续第3-5步仍需人工操作:价格行为确认、入场、出场)。
为何不采用简单失败率检查:早期设计中,只要不足半数相关事件“做出反应”就标记为“新闻反应失败”——但在纯噪声情况下,约69%的单个事件会随机无反应,因此该规则会在48%-83%的时间内误判为确认状态(取决于样本量)。本工具则要求市场对有利于拥挤头寸的新闻做出显著反向变动(采用经蒙特卡洛验证的零假设假阳性边界的漂移显著性测试),而非仅仅“反应不足”。详细统计原理请见
references/news-failure-patterns.md

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
英文场景:
  • "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?"
  • cot-contrarian-detector
    标记某市场为CROWDED_LONG/CROWDED_SHORT,且用户希望进入第二步流程时
日语场景:
  • 「この市場は好材料に反応しなかった?」
  • 「COTで偏っているこの銘柄のニュース失敗を確認して」
不适用场景:
  • 市场未处于拥挤状态(NEUTRAL分类)——若无明确
    --direction
    覆盖参数,本工具将拒绝生成判定结果
  • 尚未生成整理后的事件JSON文件——需先运行WebSearch(下文第二阶段);绝不允许伪造事件或URL来生成判定结果

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.
  • **FMP API密钥:**必填。设置环境变量
    FMP_API_KEY
    或通过
    --api-key
    参数传入。仅用于获取价格数据(
    stable/historical-price-eod/light
    )——覆盖范围因标的而异;详见
    references/price-source-map.md
  • Python 3.9+ 环境,并已安装
    requests
    库。
  • WebSearch访问权限:用于整理事件JSON文件(第二阶段)。若无该权限,工具会优雅降级(说明限制;绝不伪造事件)。
  • 可选:
    cot-contrarian-detector
    生成的JSON报告(
    --detector-json
    参数):用于自动解析标的+方向,也可直接通过
    --direction
    参数明确指定方向。

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.
通过
cot-contrarian-detector
报告(
--detector-json
参数,从
markets[]
中读取标的)或直接从用户输入获取(
--symbol
+
--direction
参数)。若报告中为NEUTRAL分类、标的未在报告中存在、或报告早于
--max-detector-age-days
(默认10天),工具将明确拒绝生成判定结果——仅当传入明确的
--direction
覆盖参数时例外。

Phase 2: Curate the events JSON via WebSearch

第二阶段:通过WebSearch整理事件JSON文件

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.
在评估窗口内(
--window-days
,默认10天)搜索新闻,采用4层级来源优先级(发行方/官方来源→SEC/官方统计→通讯社→门户平台——详见
references/news-failure-patterns.md
)。将搜索结果写入
references/news-failure-patterns.md
模板中的事件JSON文件——每个事件需包含
event
event_time
(带明确UTC偏移的ISO8601格式)、
source_url
source_tier
expected_impact
(BULLISH/BEARISH)字段。
绝不允许伪造事件或URL。若无WebSearch访问权限→明确说明;仅当用户接受
INSUFFICIENT_EVIDENCE
结果(原因
no_events_provided
)时,才可在无事件JSON文件的情况下继续——CLI绝不会因缺少事件文件抛出异常,始终会返回0退出码并说明原因。

Phase 3: Run the CLI

第三阶段:运行CLI

bash
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/
The script fetches the price series (documented fallback chain — futures symbol first, ETF proxy if 402/restricted or
rows == 0
; see
references/price-source-map.md
), computes effective dates / returns / z-scores per event, clusters events whose 3-trading-day windows overlap (independence guard), and synthesizes the verdict.
bash
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个交易日窗口重叠的事件进行聚类(独立性校验),并生成最终判定结果。

Phase 4: Present verdict + handoff

第四阶段:展示判定结果+流程交接

Present the verdict, aggregate stats (
drift_stat
,
responded_ratio
), and the evidence table (per-event returns/z-scores/reaction labels, with any
dropped_events
reasons shown — never silently hidden). If a proxy (
run_context.proxy_used
) was used, note the tracking-error caveat.
Emit a handoff block for
contrarian-setup-gate
(#241, not yet built):
json
{"news_failure": {"verdict": "CONFIRMED", "confidence": "HIGH", "report_path": "reports/nrf_B6_2026-07-12.json"}}
展示判定结果、汇总统计数据(
drift_stat
responded_ratio
)以及证据表格(每个事件的收益率/z值/反应标签,同时展示
dropped_events
的原因——绝不隐藏)。若使用了替代标的(
run_context.proxy_used
),需注明跟踪误差提示。
输出用于
contrarian-setup-gate
(#241,尚未开发)的交接块:
json
{"news_failure": {"verdict": "CONFIRMED", "confidence": "HIGH", "report_path": "reports/nrf_B6_2026-07-12.json"}}

Output

输出结果

  • 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
    — human-readable verdict, aggregate stats, evidence table, dropped-events table, proxy caveat (if used), and methodology footnote.
  • 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
    ——人类可读的判定结果、汇总统计数据、证据表格、事件剔除表格、替代标的提示(若使用)以及方法论脚注。

Guardrails

防护规则

  • CONFIRMED is not a trade signal. It confirms step 2 of 5 — price- action confirmation (step 3), entry (step 4), and exit (step 5) are still manual and still required before any position.
  • INSUFFICIENT_EVIDENCE never advances the pipeline. Fewer than
    --min-events
    (default 3) usable relevant event clusters, a missing detector report, or a detector vintage (
    data_date
    ) that's missing, unparsable, dated after
    --as-of
    , or older than
    --max-detector-age-days
    (stale), a
    NEUTRAL
    classification without an explicit override, or no working price source all produce this verdict — never a crash, never a forced call on inadequate data.
  • COT publication lag. COT data is 3-9 days old by the time it's read (see
    cot-contrarian-detector
    ); news-failure evidence should be read in that context, not as same-day confirmation.
  • Counter-direction events are context only — shown in the evidence table but excluded from the verdict (only events whose
    expected_impact
    matches the crowd's
    expected_direction
    count).
  • Proxy-based prices are noted, not hidden. When an ETF proxy was used (
    run_context.proxy_used
    ), the report says so — tracking error, expense drag, and roll-timing differences make the reaction-direction read approximate, not exact.
  • Residual statistical risk under extreme correlation. The verdict's null false-CONFIRMED rate is hard-verified under i.i.d. noise (<8%) and under a realistic residual-correlation stress (AR(1) ρ=0.1, <10%). Under an intentionally extreme correlation stress (lag-1 ρ=0.3 across non-clustered event windows — roughly 10x liquid-futures empirical autocorrelation), the measured null rate rises to ~11-13%. This is a documented v1 limitation, not a silent gap — see
    references/news-failure-patterns.md
    for the full numbers. Users who want the stricter <10% margin even under that stress can pass
    --drift-z 1.75
    (at the cost of missing some genuine news-failure signals, not just noise).
  • Not investment advice. Research/educational purposes only.
  • CONFIRMED并非交易信号:它仅确认5步流程中的第2步——价格行为确认(第3步)、入场(第4步)、出场(第5步)仍需人工操作,且是建立头寸前的必要步骤。
  • INSUFFICIENT_EVIDENCE绝不会推进流程:可用相关事件聚类数少于
    --min-events
    (默认3个)、缺少detector报告、detector报告的时间戳(
    data_date
    )缺失/无法解析/晚于
    --as-of
    /早于
    --max-detector-age-days
    (过期)、无明确覆盖参数的NEUTRAL分类、无可用价格来源等情况,都会生成该判定结果——绝不会崩溃,绝不会基于不足数据强行生成判定。
  • COT数据发布延迟:COT数据在读取时已滞后3-9天(详见
    cot-contrarian-detector
    );新闻反应失败的证据需结合该背景解读,不可视为当日确认信号。
  • 反向事件仅作为参考——会在证据表格中展示,但不纳入判定结果(仅
    expected_impact
    与拥挤群体
    expected_direction
    匹配的事件才会被统计)。
  • 替代标的价格会明确标注:当使用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
    参数(代价是会错过部分真实的新闻反应失败信号,而非仅过滤噪声)。
  • 不构成投资建议:仅用于研究/教育目的。

Resources

参考资源

references/news-failure-patterns.md

references/news-failure-patterns.md

Full methodology: what qualifies as a relevant event, the 4-tier source hierarchy, worked examples, the events-JSON curation guide + template, and the verdict-threshold rationale (why drift-significance, not a naive ratio; the Monte-Carlo-verified null bounds).
完整方法论:相关事件的定义、4层级来源优先级、示例、事件JSON整理指南+模板、判定阈值原理(为何采用漂移显著性而非简单比率;蒙特卡洛验证的零假设边界)。

references/price-source-map.md

references/price-source-map.md

Per-market price-source fallback chain, verified/402/0-rows status (live- probed at implementation time), ETF-proxy caveats, and markets with no viable source (documented
no_price_source
cases: VX, ZQ, HO, all agri on this key).
各市场的价格来源回退链、验证/402/0行状态(实现时实时探测)、ETF替代标的提示、以及无可用来源的市场(已记录的
no_price_source
案例:VX、ZQ、HO、所有农产品标的)。

When to Load References

何时加载参考资源

  • First use / explaining the methodology: Load
    references/news-failure-patterns.md
  • Explaining why a market has no verdict (no_price_source): Load
    references/price-source-map.md
  • Regular execution: References not needed for the CLI itself — needed for Phase 2 (events curation) and for explaining results to the user
  • **首次使用/解释方法论:**加载
    references/news-failure-patterns.md
  • **解释为何某市场无判定结果(no_price_source):**加载
    references/price-source-map.md
  • **常规执行:**CLI本身无需参考资源——仅在第二阶段(事件整理)和向用户解释结果时需要