correlation-risk
Skill16 starsChanged 8 months agoMITView on GitHub
Regime-dependent correlation, diversification failure, dynamic correlation models, and correlation trading strategies. Pearson Correlation - Linear association between two return series: rho = cov(X,Y) / (sigma_X * sigma_Y) - Assumes bivariate normality for inference — violated by financial returns - Sensitive to outliers: a single extreme co-movement can dominate the estimate - Does not capture non-linear dependence or tail dependence Rank Correlation (Spearman, Kendall) - Spearman: Pearson correlation on ranked data — robust to outliers - Kendall tau: proportion of concordant…
2 other projects use a version of this.
Adopted by
Most recently taken up by
- IngAs8/ClaudeSkilltheir own version, first seen Sep 28, 2026
- SKE-Labs/agent-trading-skillstheir own version, first seen Jul 18, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- SKE-Labs/agent-trading-skills★ 17same name
- IngAs8/ClaudeSkill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- live-trading-monitoringSkill
- monte-carlo-simulationSkill
- overfitting-preventionSkill
- research-notebooksSkill
- strategy-evaluationSkill
- walk-forward-optimizationSkill
- cross-chain-arbitrageSkill
- crypto-derivativesSkill
- defi-protocolsSkill
- mev-strategiesSkill
- on-chain-analyticsSkill
- stablecoin-analysisSkill
- tokenomicsSkill
- yield-farmingSkill
- alternative-dataSkill
- data-qualitySkill
- data-vendorsSkill
- feature-engineeringSkill
- sentiment-analysisSkill
- web-scraping-financeSkill
- binomial-treesSkill
- black-scholesSkill
- credit-derivativesSkill
- exotic-optionsSkill
- hedging-strategiesSkill
- interest-rate-derivativesSkill
- monte-carlo-pricingSkill
- structured-productsSkill
- vol-surfacesSkill
- vol-tradingSkill
- execution-algosSkill
- latency-optimizationSkill
- market-microstructure-theorySkill
- order-flow-analysisSkill
- performance-metricsSkill
- smart-order-routingSkill
- tick-data-processingSkill
- transaction-cost-analysisSkill
- central-bank-analysisSkill
- commodities-fundamentalsSkill
- economic-indicatorsSkill
- fx-fundamentalsSkill
- geopolitical-riskSkill
- yield-curve-analysisSkill
- alternative-allocationsSkill
- benchmark-trackingSkill
- black-littermanSkill
- factor-investingSkill
- markowitz-optimizationSkill
- portfolio-attributionSkill
- rebalancing-strategiesSkill
- risk-paritySkill
- alpha-researchSkill
- bayesian-methodsSkill
- deep-learning-tradingSkill
- factor-modelsSkill
- kalman-filtersSkill
- ml-for-financeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Does not capture non-linear dependence or tail dependence
- Distinctive: line 87
Gaussian copula: no tail dependence — underestimates joint extreme risk
- Distinctive: line 107
Must ensure the resulting matrix is positive semi-definite (nearest PSD matrix if not)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Correlation Risk Analysis
Regime-dependent correlation, diversification failure, dynamic correlation models, and correlation trading strategies.
When to Activate
- User analyzes portfolio diversification and correlation assumptions
- Correlation breakdown during market stress events
- Dynamic correlation modeling with DCC-GARCH or similar
- Correlation trading strategies (dispersion, correlation swaps)
- Risk model validation where correlation assumptions drive results
- Multi-asset portfolio construction sensitive to correlation estimates
Core Concepts
Correlation Measurement
Pearson Correlation
- Linear association between two return series: rho = cov(X,Y) / (sigma_X * sigma_Y)
- Assumes bivariate normality for inference — violated by financial returns
- Sensitive to outliers: a single extreme co-movement can dominate the estimate
- Does not capture non-linear dependence or tail dependence
Rank Correlation (Spearman, Kendall)
- Spearman: Pearson correlation on ranked data — robust to outliers
- Kendall tau: proportion of concordant vs. discordant pairs — better for small samples
- Both capture monotonic (not just linear) relationships
- Preferred for non-normal distributions and copula calibration
Rolling Correlation
- Compute correlation over a trailing window (e.g., 60, 120, 252 days)
- Reveals time-varying nature of correlation
- Window length tradeoff: short = responsive but noisy; long = stable but lagging
- Exponentially weighted correlation: more weight on recent observations, decay factor lambda
Correlation Dynamics in Crises
The most dangerous property of correlation: it increases precisely when diversification is needed most.
- During calm markets: cross-asset correlations are moderate, diversification works
- During stress: correlations spike toward 1.0 (or -1.0 for safe havens), diversification fails
- Equity correlations: pairwise stock correlations routinely jump from 0.3 to 0.7+ in sell-offs
- Cross-asset: equity-credit correlation spikes (both sell off); equity-Treasury correlation flips negative (flight to quality)
- 2022 anomaly: stocks and bonds fell together — 60/40 portfolio assumption of negative correlation failed
- Correlation asymmetry: higher correlation in down markets than up markets (documented in academic literature)
Why Correlation Increases in Stress
- Common factor dominance: in crisis, a single "risk-on/risk-off" factor drives all assets
- Leverage and forced selling: margin calls force liquidation across asset classes simultaneously
- Information cascading: panic spreads, investors herd into similar trades
- Liquidity withdrawal: market makers widen spreads on everything, co-movement increases mechanically
- Volatility effect: correlation and volatility are positively linked (conditional correlation rises with vol)
Methodology
Dynamic Conditional Correlation (DCC-GARCH)
The DCC model of Engle (2002) captures time-varying correlation:
- Step 1 — Univariate GARCH: fit GARCH(1,1) to each return series to obtain standardized residuals
- h_it = omega_i + alpha_i * r_{i,t-1}^2 + beta_i * h_{i,t-1}
- Standardized: epsilon_it = r_it / sqrt(h_it)
- Step 2 — Dynamic correlation: model the correlation of standardized residuals
- Q_t = (1 - a - b) * Q_bar + a * epsilon_{t-1} * epsilon_{t-1}' + b * Q_{t-1}
- R_t = diag(Q_t)^{-1/2} * Q_t * diag(Q_t)^{-1/2} (normalize to get correlation matrix)
- Parameters a and b control correlation dynamics (a = news impact, b = persistence)
- Q_bar is the unconditional correlation matrix of standardized residuals
- Estimation: two-step quasi-maximum likelihood — first step estimates univariate GARCH, second step estimates DCC parameters
- Advantages: captures time variation, mean-reversion in correlation, parsimonious (2 parameters for any dimension)
- Limitations: symmetric (does not distinguish up/down moves), computationally intensive for large N
Asymmetric DCC (aDCC)
Extends DCC to capture the asymmetry that correlations increase more in downturns:
- Q_t = (1-a-b)Q_bar - gN_bar + aepsilon_{t-1}epsilon_{t-1}' + bQ_{t-1} + gn_{t-1}*n_{t-1}'
- Where n_t = epsilon_t if epsilon_t < 0, else 0 (captures negative shocks)
- Parameter g captures the asymmetric correlation response to negative returns
Copula-Based Dependence Modeling
Copulas separate marginal distributions from the dependence structure:
- Gaussian copula: no tail dependence — underestimates joint extreme risk
- Student-t copula: symmetric tail dependence — better for financial data
- Clayton copula: lower (left) tail dependence — captures crash co-movement
- Time-varying copulas: fit copula parameters dynamically, similar to DCC approach
- Calibration: use Kendall's tau or maximum likelihood on pseudo-observations
Correlation Risk in Portfolio Context
Diversification Ratio
- DR = (sum of w_i * sigma_i) / sigma_portfolio
- DR = 1 means no diversification (perfect correlation); higher DR = more diversification
- Monitor DR over time; declining DR signals rising correlations
Effective Number of Bets (ENB)
- Based on PCA of the portfolio return covariance
- ENB = exp(-sum of p_i * ln(p_i)) where p_i are normalized eigenvalue shares
- Low ENB despite many positions means hidden concentration through correlation
Correlation Stress Testing
- Stressed correlation matrix: increase all pairwise correlations by a fixed amount (e.g., +0.3)
- Must ensure the resulting matrix is positive semi-definite (nearest PSD matrix if not)
- Alternatively, use shrinkage: C_stressed = (1-w)C_current + wC_crisis
- Compute portfolio risk under stressed correlations
Examples
Rolling Correlation Regime Detection
SPY-TLT rolling 60-day correlation:
2019 (calm): -0.35 (negative — diversification working)
Mar 2020 (COVID): -0.55 (strongly negative — flight to quality)
2021 (recovery): -0.20 (weakly negative)
2022 (inflation): +0.40 (positive — stocks and bonds falling together)
2023 (normalization): -0.25 (returning to negative)
A 60/40 portfolio assuming -0.30 correlation was severely mispriced in 2022.
Actual 2022 portfolio vol was 40% higher than model predicted due to correlation shift.DCC-GARCH Fitted Correlation
Pair: Bank of America (BAC) vs. JPMorgan (JPM)
DCC parameters: a = 0.03, b = 0.95 (high persistence)
Unconditional correlation: 0.78
Conditional correlation range: 0.55 (calm periods) to 0.95 (crisis periods)
2008 peak conditional correlation: 0.96
2020 COVID peak: 0.93
Current: 0.75
Implication: during stress, these two positions offer almost zero diversification.
Portfolio VaR assuming constant 0.78 correlation underestimates stress losses by 15-20%.Dispersion Trading Example
S&P 500 implied correlation (from index vol vs. component vols): 0.65
Historical realized correlation (trailing 3 months): 0.50
Trade: Sell index straddle, buy single-stock straddles (short correlation).
Profit if realized correlation stays below implied correlation.
Risk: correlation spike event (market crash) causes large loss on short index vol.
Size: limit notional so max loss at correlation = 1.0 is within risk budget.Quality Gate
- Correlation estimates must use at least 120 observations (approximately 6 months daily data)
- DCC model must be validated: Ljung-Box test on standardized residuals, likelihood ratio test vs. constant correlation
- Stressed correlation matrix must be verified as positive semi-definite
- Portfolio risk under both current and stressed correlation must be reported
- Diversification ratio and ENB must be monitored and reported alongside standard risk metrics
- Correlation asymmetry must be tested: compare up-market vs. down-market correlations
- Copula model selection must be justified: compare Gaussian, t, and Clayton via AIC/BIC
- Tail dependence estimates must accompany linear correlation for any risk assessment
- Correlation assumptions in risk models (VaR, ES) must be stress-tested separately
- Re-estimate dynamic correlation models at least monthly; review for regime changes quarterly
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

