cointegration-analysis

Test cointegration between two time series using Engle-Granger and Johansen methods.

266|54|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/agiprolabs/claude-trading-skills --skill cointegration-analysis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cointegration-analysis
Source: https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/cointegration-analysis
Command: npx skills add https://github.com/agiprolabs/claude-trading-skills --skill cointegration-analysis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, pandas, scipy, statsmodels, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps traders and quantitative analysts identify pairs of financial assets that exhibit a stable, long-term relationship, enabling the development of pairs trading and statistical arbitrage strategies.

Core Features & Use Cases

  • Cointegration Testing: Implements Engle-Granger and Johansen tests to statistically validate long-run relationships between asset prices.
  • Hedge Ratio Estimation: Calculates the optimal ratio for constructing a market-neutral spread.
  • Mean Reversion Analysis: Assesses the stationarity and speed of convergence of the spread using ADF tests, Hurst exponents, and half-life calculations.
  • Rolling Stability: Monitors cointegration relationships over time to detect structural breaks.
  • Use Case: A quantitative analyst can use this Skill to screen a universe of cryptocurrencies for pairs that are cointegrated, estimate their hedge ratio, and determine if the spread is mean-reverting, thus identifying potential pairs for a statistical arbitrage strategy.

Quick Start

Analyze the cointegration between 'SOL' and 'ETH' price series using the cointegration analysis skill.

Frequently Asked Questions about cointegration-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test for cointegration between two assets for pairs trading?

Cointegration testing validates long-run relationships between asset prices using Engle-Granger and Johansen tests, estimating hedge ratios to construct market-neutral spreads suitable for statistical arbitrage strategies.

What does the Hurst exponent tell me about mean reversion in a spread?

The Hurst exponent measures the speed and stationarity of spread convergence, complementing ADF tests and half-life calculations to assess whether a cointegrated spread exhibits reliable mean reversion.

Can I detect structural breaks in cointegration relationships over time?

Rolling stability analysis monitors cointegration relationships over time to detect regime shifts and structural breaks, ensuring the long-term statistical link between asset pairs remains valid.

How do I estimate the optimal hedge ratio for a market-neutral spread?

Hedge ratio estimation calculates the optimal weighting between two cointegrated assets, constructing a stationary spread that enables pairs trading when price divergence creates arbitrage opportunities.

Does this cointegration analysis work with cryptocurrency time series?

Yes, quantitative analysts can screen cryptocurrency universes for cointegrated pairs, estimating hedge ratios and determining spread stationarity to identify potential statistical arbitrage opportunities.