Skip to content

Correlation and Cointegration Analysis

Finds related assets, tests long-run links, and drafts pair-trading signals from price and return data

Stars
37,433
Licence
MIT
Files
1 file

What it does

Once installed, the agent approaches questions about how financial assets move together with a fixed method. It can scan a universe of assets for correlated candidates, run a full set of correlation statistics (Pearson, Spearman, Kendall, beta, R-squared, rolling correlation, spread Z-score), cluster assets into sector-like groups from their correlation matrix, and test whether pairs are cointegrated (Engle-Granger, Johansen, half-life, Kalman hedge ratio) to produce pair-trading signals. It supplies Python code templates for these steps.

Great for

  • Quantitative analysts or students building pairs-trading or hedging studies
  • Portfolio builders checking diversification across holdings
  • Developers who want reusable correlation and cointegration code for financial return data

Skip it if

  • Trading decisions with real money without independent validation: correlations and cointegration often break down out of sample, and the skill does not backtest or manage risk
  • Non-financial data where return-series assumptions do not apply, since the methods assume financial return series

Try asking

  • “Find the 10 stocks most correlated with my target ticker and test which pairs are cointegrated”
  • “Run a full bivariate correlation study between two ETFs, including beta, R-squared and a rolling 60-day correlation”
  • “Cluster my portfolio's assets into sectors using hierarchical clustering on their return correlations”
  • “Estimate the half-life of the spread between two assets and generate a z-score pair-trading signal”
Step-by-step guide: how to use Correlation and Cointegration AnalysisInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    correlation-analysis.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip correlation-analysis.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip correlation-analysis.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Provide clean, aligned daily return data with the same date index for all assets before running the scans
  • Treat correlation thresholds (such as 0.8 or 0.6) as starting points and check results against industry and factor context
  • Validate any pair-trading signal on out-of-sample data before acting on it

What's inside

  • SKILL.md

Redistributed unmodified from HKUDS/Vibe-Trading under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.