cointegration-analysis

cointegration-analysis is a skill for Claude Code from agiprolabs/claude-trading-skills. It costs 23 tokens per session (2,167 once invoked), scanned A, original, MIT.

A statistical method for finding pairs of assets whose prices may move back toward a shared long-term relationship, used in pairs trading.

In plain words
What is it for?
It helps test asset pairs with the Engle-Granger and Johansen methods and check whether the relationship remains stable over rolling periods.
Why use it?
Simple correlation shows whether prices move together in the short term, but it does not show whether their gap tends to return to a stable level.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the trading-skills plugin — 68 skills shipped together

not rated 354repo +12 8d ago A scan Socket: passSnyk: passSkillSpector: warn 23 tokens original MIT

Good fit It helps test asset pairs with the Engle-Granger and Johansen methods and check whether the relationship remains stable over rolling periods.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agiprolabs/claude-trading-skills/cointegration-analysis
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add agiprolabs/claude-trading-skills --skill cointegration-analysis
Clone the repo
git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills

Made for: Claude Code.

Or install trading-skills, the plugin that ships this one along with the rest of its 68 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cointegration-analysis

README.md
[![agentmods](https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/cointegration-analysis/github.svg)](https://agentmods.dev/skills/agiprolabs/claude-trading-skills/cointegration-analysis)
Your own site
<a href="https://agentmods.dev/skills/agiprolabs/claude-trading-skills/cointegration-analysis"><img src="https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/cointegration-analysis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cointegration-analysis

Your own site · 80×15
<a href="https://agentmods.dev/skills/agiprolabs/claude-trading-skills/cointegration-analysis"><img src="https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/cointegration-analysis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,167 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 21 Mar 2026
  • Snyk pass 21 Mar 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium analysis-evasion · line 1
    Suspicious Unicode normalization or mixed-script content
    Fix: Review the flagged content for security risks. Ensure no credentials, secrets, or sensitive data are exposed.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.02167
Opus 5 $0.00012 $0.01084
Sonnet 5 $0.00005 $0.00433
Haiku 4.5 $0.00002 $0.00217

Measured 11d ago against content hash b327746b5993, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cointegration-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/pairs_backtest.py, scripts/test_cointegration.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cointegration-analysis/SKILL.md · 245 lines

How it starts

The opening of the file, as written. The whole thing — 245 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cointegration Analysis

Cointegration testing identifies pairs of assets that share a long-run equilibrium relationship, enabling statistical arbitrage and pairs trading strategies.

What Is Cointegration?

Two price series are cointegrated when they are individually non-stationary (random walks) but a linear combination of them is stationary (mean-reverting). Intuitively, the prices may wander apart temporarily but are pulled back to an equilibrium spread over time.

Cointegration vs Correlation

Property Correlation Cointegration
Measures Short-term co-movement Long-run equilibrium
Stationarity Requires stationary returns Works with non-stationary prices
Time horizon Can change rapidly Stable over months/years
Trading use Momentum/trend signals Mean-reversion pairs trades
Failure mode Breaks in regime changes Breaks on structural shifts

Two assets can be highly correlated but not cointegrated (e.g., two unrelated uptrends). Conversely, cointegrated assets may have low short-term correlation during temporary divergences — which is exactly when pairs trades are entered.

Why It Matters

  • Pairs trading: Long the underperformer, short the outperformer, profit on convergence
  • Statistical arbitrage: Systematic mean-reversion on spread z-scores
  • Spread trading: Trade the spread directly as a synthetic instrument
  • Risk hedging: Cointegrated hedge ratios minimize tracking error over time

Methods

1. Engle-Granger Two-Step

The most common approach for two series.

Step 1 — Regress Y on X using OLS:

Y_t = α + β * X_t + ε_t

Step 2 — Test the residuals ε_t for stationarity using the ADF test.

  • If residuals are stationary (p < 0.05) → Y and X are cointegrated
  • β is the hedge ratio for the pairs trade
  • α is the long-run mean of the spread

Important: Engle-Granger critical values differ from standard ADF critical values. For n=2 series: 1% = -3.90, 5% = -3.34, 10% = -3.04.

Read the full file on GitHub · 245 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 245 lines · 23 tokens per session scan A b327746b5993

Subscribe to this mod's changes

cointegration-analysis is a skill published in the GitHub repository agiprolabs/claude-trading-skills (354 stars, last pushed 8d ago), licensed MIT. It adds 23 tokens to every session and 2,167 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

monte-carlo

Use when the user wants Monte Carlo simulation of a PlanExe model — sampling from bounds to produce output distributions (mean/std/percentiles), threshold pass probabilities, and Pearson-correlation sensitivity rankings — given an extract-parameters-from-full JSON, a generate-bounds JSON, a generate-calculations…

PlanExeOrg/PlanExe · 71 tokens

neqsim-utility-design

Screening-level utility-system DESIGN with NeqSim Java classes and the MCP designUtilities tool — fired steam Boiler, Deaerator, vapour-compression RefrigerationCycle, on-site NitrogenSystem generator, and multi-pressure SteamNetwork header cascade, plus the UtilitySystemDesigner aggregator that harvests demands from…

equinor/neqsim · 144 tokens

fin-paper-figure

Generate academic-quality figures (>=300 DPI) for economics and finance papers.

csmar432/finai-research · 14 tokens

quant-experiment-runtime

Quant research experiment executor: discover an offline source database under the workdir's code-repo, build a panel, run a Research Artifact's entry point to compute research-object values, and evaluate IC/ICIR/RANKIC/coverage metrics. Runtime = Experiment Executor; it runs a Research Artifact via a Python-native…

CamusGIT/EvoQuant · 179 tokens

fin-paper-writing

A workflow for turning a research outline and study design into a complete economics or finance paper. It coordinates drafting, figure creation, consistency checks, review rounds, LaTeX compilation, and submission checks.

csmar432/finai-research · 65 tokens

fin-viz-launch

A tool for turning research data and a written description into academic charts. It can choose a suitable chart type, create plotting code with matplotlib or seaborn, and save the result as a high-resolution PDF, SVG, or PNG.

csmar432/finai-research · 45 tokens