
COT Contrarian Detector
FreeIdentify crowded speculative positions in futures markets.
Free · Opens the source repo
What COT Contrarian Detector does
The COT Contrarian Detector skill is designed to help traders analyze the Commitment of Traders (COT) reports to identify crowded speculative positions in futures markets. By leveraging Jason Shapiro's methodology, this skill focuses on detecting when large speculators, such as hedge funds and momentum traders, are excessively positioned on one side of the market. This crowded positioning often signals potential reversals, making it a valuable tool for contrarian traders seeking to capitalize on market inefficiencies.
This skill operates by screening net positioning across 65 futures markets, including indices, rates, foreign exchange, metals, energy, and crypto. It computes a 3-year and a 26-week COT Index for each market, categorizing them as CROWDED_LONG or CROWDED_SHORT based on their positioning extremes. Users can run the crowding screen using a simple Python script, which fetches the latest COT data and generates a report detailing the crowded markets. The output includes insights into the degree of crowding and the historical context of the positioning, enabling users to make informed decisions.
However, it is important to note that this skill only automates the first step of the contrarian trading process. While it provides valuable insights into crowded positioning, it does not generate trade signals. Users must manually follow up with additional steps, including analyzing news failures and price action, to confirm potential trading opportunities. This makes the skill particularly suited for traders who are familiar with the COT analysis process and are looking for a tool to streamline their initial screening efforts.
The COT Contrarian Detector is ideal for traders who want to identify speculative extremes in the futures markets and are comfortable taking the next steps in the trading process themselves. It is not suitable for those seeking immediate trade signals or for analysis of individual equities, as it focuses solely on CFTC futures markets.
When to use it
Use this skill when you want to analyze COT reports for crowded speculative positioning in futures markets or when seeking contrarian setups.
When not to use it
Do not use this skill if you need immediate trade signals, as it only detects crowding and does not provide actionable trading recommendations.
What you can build with it
Weekly COT Analysis
Run the COT Contrarian Detector weekly after the COT report is published to get fresh insights on crowded positioning.
Ad Hoc Market Screening
Use the skill to check specific markets for crowded positioning when you suspect a potential reversal.
Contrarian Trading Setup
Leverage the skill to identify markets with extreme positioning and follow up with manual analysis for trading opportunities.
How to install COT Contrarian Detector
View source1. Install with the skills CLI
npx skills add tradermonty/claude-trading-skills/cot-contrarian-detector --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by tradermontyCOT Contrarian Detector
Overview
Implements step 1 of Jason Shapiro's COT (Commitment of Traders) contrarian process: detect when large speculators are crowded into one side of a futures market. Crowded positioning is a precondition for a contrarian trade, not a trade signal — a market only becomes tradable once crowding is confirmed by a news failure and price-action reversal (steps 2-3), which this skill guides the user through manually.
Core thesis (Shapiro): Large speculators (hedge funds, CTAs, momentum traders) tend to be maximally positioned at trend exhaustion, not trend inception. When they are already crowded onto one side, the next big move is statistically more likely to run them over than to reward them further. Fade the speculators, not the commercials (commercials hedge for structural reasons and are not a crowd-psychology signal).
When to Use This Skill
English:
- "What markets are the speculators crowded into right now?"
- "Run a COT report analysis" / "Show me COT positioning extremes"
- "Is anyone 'trapped' in gold / the dollar / bonds right now?"
- User wants to find contrarian futures setups
- User asks for a Jason Shapiro-style COT screen
Japanese:
- 「COTレポートで買われすぎ・売られすぎのポジションを調べて」
- 「投機筋が偏っている市場は?」
- 「ジェイソン・シャピロ式の逆張り分析をして」
Do NOT use when:
- The user wants a trade signal right now — crowding alone is not actionable; see Guardrails below
- The user is asking about individual equities — COT reports cover CFTC futures markets only (indices, rates, FX, metals, energy, agri, crypto), not single stocks
Prerequisites
- FMP API Key: Required. Set
FMP_API_KEYenvironment variable or pass--api-key. COT endpoints require an FMP Premium+ plan — a free-tier key will not have access. - Python 3.9+ with
requestsinstalled. - API Budget: One call per market (23 for
--core, up to ~65 for the full universe), plus one call for the market list when neither--symbolsnor--coreis given.
Workflow
Phase 1: Run the crowding screen
# Curated core futures universe (23 liquid/representative markets)
python3 skills/cot-contrarian-detector/scripts/screen_cot_crowding.py --core --output-dir reports/
# Explicit symbols
python3 skills/cot-contrarian-detector/scripts/screen_cot_crowding.py --symbols "ES,GC,CL" --output-dir reports/
# Full universe (all ~65 markets FMP's COT list covers)
python3 skills/cot-contrarian-detector/scripts/screen_cot_crowding.py --output-dir reports/
The script fetches each market's weekly legacy COT report (large-speculator long/short positions), computes a 156-week (3-year) and 26-week COT Index per market, and classifies extremes:
CROWDED_LONG— COT Index >= 90 (near the 3-year net-long high)CROWDED_SHORT— COT Index <= 10 (near the 3-year net-short high)NEUTRAL— everything in between
Markets with insufficient history to compute the index are never silently
dropped — they appear in a skipped list with the reason (e.g. "insufficient
history: 40/156 weeks").
Phase 2: Present the crowding report
Present the generated Markdown report, highlighting:
- Which markets are
CROWDED_LONG/CROWDED_SHORTand by how much - The 26-week index for context (is the crowding fresh or aging?)
- Week-over-week net-position swings (fast-moving crowds are more fragile)
- The methodology note and disclaimer — crowding is not a trade signal
Phase 3: Guide steps 2-5 manually (Shapiro process)
For any CROWDED_LONG / CROWDED_SHORT market the user wants to pursue,
load references/shapiro-methodology.md and walk through the remaining
steps — these are not automated:
Crowding detection(done — this skill)- News failure — use WebSearch to check whether recent news favorable to the crowd's direction failed to move price the way the crowd would expect (e.g. crowded-long market doesn't rally on bullish news). This is the core edge and the most important manual confirmation.
- Price-action confirmation — check the weekly chart for a reversal pattern or a failure at a new high/low.
- Entry — against the crowd, with a stop at the recent swing extreme and
small, fixed-risk sizing (see
position-sizerskill). - Exit — when positioning normalizes toward neutral (COT Index back toward 50) or the stop is hit.
Never recommend an entry from crowding alone — steps 2 and 3 must both confirm first.
Output
- JSON:
reports/cot_crowding_<as-of-date>.json— machine-readable, with arun_contextblock (schema_version, params, universe, data_date) plusmarkets(ranked results) andskipped(never silently dropped). - Markdown:
reports/cot_crowding_<as-of-date>.md— human-readable report with Crowded Long / Crowded Short / Full Ranking / Week-over-Week Swings / Skipped Markets / Methodology sections.
Cadence
CFTC publishes the COT report Fridays ~3:30pm ET, with positions as of the prior Tuesday — data is always 3+ days old by the time it's published, and up to 9 days old by the following Friday. Run this skill:
- Weekly, after Friday's publication or over the weekend, for a fresh read
- Ad hoc, when the user asks about a specific market's positioning — the underlying data will be from the most recent Friday release either way
Guardrails
- Crowdedness alone is NOT a trade signal. It is a precondition. Never
suggest an entry without steps 2 (news failure) and 3 (price action) from
references/shapiro-methodology.mdalso confirming. - Data is lagged. COT positions are 3-9 days old by the time they're read; do not treat them as a real-time signal.
- Fade speculators, not commercials. This skill only looks at non-commercial ("large speculator") positioning — commercial hedging flows are structurally different and not a crowd-psychology signal.
- Not investment advice. All output is for research/educational purposes.
Resources
references/shapiro-methodology.md
The full 5-step process (crowding → news failure → price action → entry → exit), why speculators (not commercials) are the fade target, the 3-day publication lag caveat, and a table of what this skill automates vs. what stays manual. Load this whenever guiding a user past step 1.
references/cot-index-calculation.md
The COT Index formula, lookback rationale (156w primary / 26w context),
extreme threshold sensitivity, open-interest normalization rationale, the
legacy-vs-disaggregated report distinction (this skill uses the legacy
report's non-commercial = large-speculator fields), and a glossary of the FMP
COT API field names consumed by scripts/cot_index.py.
When to Load References
- First use / explaining the methodology: Load
references/shapiro-methodology.md - Explaining a specific number in the report: Load
references/cot-index-calculation.md - Regular execution: References not needed — the script handles the crowding computation
Frequently asked questions about COT Contrarian Detector
Similar skills
Scientific Problem Selection
Streamline your research problem selection process.
Nextflow Development
Run nf-core bioinformatics pipelines with ease.
Nature Reviewer Assessment
Simulate peer review for scientific manuscripts.
Research Writing Pipeline
Streamline your scientific writing with structured proposal-first methodologies.
Nature Literature Downloader
Efficiently download academic literature from various sources.
Auto Research
Streamline your NeMo-RL experiments with automated workflows.
