correlation-analysis

Analyze asset price relationships with correlation metrics and cointegration tests.

6.1k|1.2k|Updated Jun 9, 2022
One-click install
npx skills add https://github.com/charliedream1/ai_quant_trade --skill correlation-analysis-charliedream1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: correlation-analysis
Source: https://github.com/charliedream1/ai_quant_trade/tree/main/a_%E5%85%A8%E7%BD%91%E4%BC%98%E7%A7%80%E8%B5%84%E6%BA%90/10_%E5%A4%A7%E6%A8%A1%E5%9E%8B/07_skill%E5%8C%85/vibe_trading_skills/correlation-analysis
Command: npx skills add https://github.com/charliedream1/ai_quant_trade --skill correlation-analysis-charliedream1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Correlation and cointegration analysis enable traders to identify stable relationships across assets, detect meaningful co-movements, and generate data-driven trading signals.

Core Features & Use Cases

  • Co-Movement Discovery: scan a universe to find highly correlated assets for potential pairs trading.
  • Deep Return-Correlation Analysis: compute multiple correlation metrics, perform regression and rolling analysis, and derive hedging insights.
  • Sector Clustering: cluster assets by correlations to reveal sector structure and diversification opportunities.
  • Realized Correlation & Cointegration: evaluate time-varying correlations and test for Engle-Granger and Johansen cointegration across asset sets.
  • Pair-Trading Signals: generate Z-score based signals with optional Kalman hedge ratios and mean-reverting spreads.

Quick Start

Run a full correlation-and-cointegration workflow on a target asset universe to identify co-movement, test for cointegration, and generate trading signals.

Frequently Asked Questions about correlation-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 pair trading?

To test for cointegration, apply Engle-Granger and Johansen tests to evaluate whether asset price pairs share a long-term equilibrium. These methods identify stable relationships suitable for generating mean-reverting spreads and actionable pair-trading signals.

What is the difference between correlation and cointegration in multi-asset portfolios?

Correlation measures co-movement using metrics like Pearson, Spearman, or Kendall, while cointegration evaluates long-term equilibrium relationships. Cointegration reveals deeper structural links across multi-asset portfolios for hedging and diversification beyond simple price correlation.

How do I calculate dynamic hedge ratios using a Kalman filter?

To calculate dynamic hedge ratios, apply a Kalman filter to adjust the relationship between asset pairs over time. This generates Z-score based pair-trading signals with mean-reverting spreads that adapt to changing market conditions.

Can I cluster assets by correlation to find sector diversification opportunities?

Yes, you can cluster assets by computing correlation metrics to reveal underlying sector structures. This clustering identifies diversification opportunities by grouping assets with similar co-movement patterns across multi-asset portfolios.

What is the best way to generate Z-score based pair-trading signals?

The best way to generate Z-score based pair-trading signals is to combine cointegration tests with half-life estimation and optional Kalman dynamic hedge ratios. This approach identifies mean-reverting spreads to support actionable entries and exits.

When should I use Johansen over Engle-Granger cointegration tests?

Use Johansen cointegration tests for multi-asset portfolios to evaluate multiple cointegrating vectors simultaneously. Engle-Granger is better suited for simple two-asset pair trading where you only need to test a single long-term equilibrium relationship.