correlation-analysis

Measure co-movement and cointegration to generate Z-score pair-trading signals.

Updated May 5, 2026
One-click install
npx skills add https://github.com/wudye/traderAssistHK --skill correlation-analysis-wudye
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: correlation-analysis
Source: https://github.com/wudye/traderAssistHK/tree/main/backend/src/skills/correlation-analysis
Command: npx skills add https://github.com/wudye/traderAssistHK --skill correlation-analysis-wudye

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you discover and validate assets with stable co-movement relationships, then turn that evidence into actionable pair-trading signals through correlation, cointegration, and spread mean-reversion analysis.

Core Features & Use Cases

  • Co-movement Discovery: Scan a universe to rank candidates by Pearson/Spearman correlation and filter to a Top-K pool for further testing.
  • Deep Return-Correlation Analysis: Quantify bivariate relationships with multiple correlation measures, OLS beta/alpha/R², rolling correlation, and spread Z-score features.
  • Cointegration & Spread Diagnostics: Run Engle-Granger and Johansen tests, compute spread half-life, and estimate both static and dynamic (Kalman) hedge ratios.
  • Realized Correlation & Regime Insight: Measure how correlations change across bull/bear/high-volatility regimes using rolling windows and conditional summaries.
  • Pair-Trading Signal Generation: Convert cointegration-validated spreads into entry/exit/stop Z-score state-machine signals for long/short spread positioning.

Quick Start

Run correlation and cointegration screening for your target asset, then generate pair-trading long/short signals using Z-score thresholds, half-life-informed lookbacks, and (optionally) a Kalman dynamic hedge ratio.

Frequently Asked Questions about correlation-analysis

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

FAQPage Schema
How do I find tradable pairs using correlation and cointegration tests?

Find tradable pairs by scanning your asset universe to rank candidates via Pearson/Spearman correlation, then validate their long-run equilibrium using Engle-Granger or Johansen cointegration tests.

How do I generate mean-reversion trading signals from a cointegrated spread?

Generate mean-reversion trading signals by converting the cointegration-validated spread into a Z-score state machine with configurable entry, exit, and stop thresholds for long or short positioning.

When should I use a Kalman filter for dynamic hedge ratios in pairs trading?

Use a Kalman filter for dynamic hedge ratios when static OLS betas fail to capture changing co-movement dynamics, adapting the spread calculation to improve mean-reversion signal accuracy.

Can I measure how asset correlation changes across different market volatility regimes?

Yes, measure realized correlation across bull, bear, and high-volatility regimes by applying rolling windows and conditional summaries to capture shifting cross-market linkages and lead-lag dynamics.

What statistics are needed to validate a spread for pairs trading?

Validating a spread requires cointegration statistics like Engle-Granger or Johansen p-values, spread half-life estimates, and dynamic hedge ratios to confirm the mean-reversion equilibrium.