Skip to content
Agentmart
Submit a tool

correlation-analysis

Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

Skill by Serennity007

IndexedMIT★ 41
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/serennity007-correlation-analysis

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

Use cases: finance

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 2

  • api.coingecko.com · found in code
  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/correlation-analysis

What's inside

Skill name
correlation-analysis
Description
Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation
License
MIT
Instructions
272 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (5)

  • SKILL.md
  • methodology.md · references/
  • portfolio_applications.md · references/
  • correlation_matrix.py · scripts/
  • rolling_correlation.py · scripts/

SKILL.md (first lines)

# Correlation Analysis

Cross-asset correlation analysis for diversification assessment, risk management, pairs trading signal generation, and portfolio construction.

## Why Correlation Matters

Correlation measures how assets move together. In crypto markets this is critical for:

- **Diversification**: holding correlated assets provides no diversification benefit — you are effectively holding one concentrated position
- **Risk management**: portfolio risk depends on the correlation structure, not just individual asset volatility
- **Pairs trading**: highly correlated assets that temporarily diverge create mean-reversion opportunities
- **Portfolio construction**: optimal allocation requires accurate correlation estimates
- **Crash protection**: understanding tail dependence reveals whether assets crash together

## Correlation Methods

### Pearson Correlation

Linear correlation assuming normality. Most common but least robust for crypto.

```python
import pandas as pd
import numpy as np

# Always compute on returns, never on prices
returns_a = prices_a.pct_change().dropna()
returns_b = prices_b.pct_change().dropna()

pearson_corr = returns_a.corr(returns_b)  # default is Pearson
```

- **Range**: -1 (perfect inverse) to +1 (perfect co-movement)
- **Assumes**: linear relationship, normally distributed returns, no outliers
- **Limitation**: crypto returns are heavy-tailed — Pearson underestimates extreme co-movement

### Spearman Rank Correlation

Converts values to ranks, then computes Pearson on ranks. Captures monotonic (not just linear) relationships.

```python
spearman_corr = returns_a.corr(returns_b, method='spearman')
```

- More robust to outliers and non-linear relationships
- Better for crypto due to heavy-tailed return distributions
- Slightly lower power than Pearson when normality holds

### Kendall Tau Correlation

Counts concordant vs discordant pairs. Most robust to outliers.

```python
kendall_corr = returns_a.corr(returns_b, method='kendall')
```

- Most robust to outliers of the three methods
- Computationally slower on large datasets
- Best for small samples or heavily skewed data

## Rolling Correlation

Static correlation hides regime changes. Rolling correlation reveals how relationships evolve.

### Window-Based Rolling Correlation

```python
# Rolling Pearson correlation
rolling_corr = returns_a.rolling(window=60).corr(returns_b)

# Multiple windows for different time horizons
windows = {
    'short': 20,    # ~1 month of trading days
    'medium': 60,   # ~3 months
    'long': 120,    # ~6 months
}
for label, w in windows.items():
    df[f'corr_{label}'] = returns_a.rolling(w).corr(returns_b)
```

### EWMA Correlation

Exponentially weighted — more responsive to recent changes.

```python
def ewma_correlation(x: pd.Series, y: pd.Series, span: int = 60) -> pd.Series:
    """Compute EWMA correlation between two return series."""
    cov_xy = x.mul(y).ewm(span=span).mean() - x.ewm(span=span).mean() * y.ewm(span=span).mean()
    std_x = x.ewm(span=span).std()
    std_y = y.ewm(span=span).std()
    return cov_xy / (std_x * std_y)
```

### Typical Windows

| Window | Days | Use Case |
|--------|------|----------|
| Short  | 20   | Tactical trading, pairs entry/exit |
| Medium | 60   | Strategy allocation, regime detection |
| Long   | 120  | Portfolio construction, strategic allocation |

## Correlation Matrix Analysis

### Computing the Full Matrix

```python
# Build return matrix for multiple assets
returns = pd.DataFrame({
    'BTC': btc_returns,
    'ETH': eth_returns,
    'SOL': sol_returns,
    'AVAX': avax_returns,
})

# Correlation matrix (Pearson)
corr_matrix = returns.corr()

# Spearman (better for crypto)
spearman_matrix = returns.corr(method='spearman')
```

From Serennity007/awesome-stock-quant-skills, MIT.

More from Serennity007/awesome-stock-quant-skills

Signals

Stars
41
Forks
8
Open issues
1
Last commit (this folder)
Aug 25, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Serennity007

Cite this page

correlation-analysis skill. Agent Mart. https://agentmart.dev/skills/serennity007-correlation-analysis (last updated 2026-10-24)