stock-correlation

Analyze stock co-movement, correlation matrices, and regime-dependent relationships using yfinance price history.

3.3k|382|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/himself65/finance-skills --skill stock-correlation-himself65
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: stock-correlation
Source: https://github.com/himself65/finance-skills/tree/main/plugins/market-analysis/skills/stock-correlation
Command: npx skills add https://github.com/himself65/finance-skills --skill stock-correlation-himself65

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires yfinance, pandas, numpy, scipy, and includes references (resource) components.

What problem does it solve? Investors and analysts need to know which stocks move together to find sympathy plays, build hedging pairs, or diversify portfolios, but computing correlations, betas, and rolling statistics from raw price data is tedious and error-prone. ## Core Features & Use Cases - Co-movement Discovery: Given a single ticker, dynamically build a peer universe via the yfinance Screener API and rank the most correlated stocks. - Pairwise Return Correlation: Compute Pearson correlation, beta, R-squared, spread Z-score, and rolling stability between two tickers. - Sector Clustering & Realized Correlation: Generate NxN correlation matrices with hierarchical clustering, plus rolling 20/60/120-day and regime-conditional (up/down/high-vol) correlation analysis. - Use Case: Ask "what correlates with NVDA?" to get a ranked table of correlated peers with explanations, or "correlation between AMD and NVDA" for a full statistical summary card. ## Quick Start Ask the agent to analyze the correlation between AMD and NVDA over the past year.

Frequently Asked Questions about stock-correlation

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

FAQPage Schema
How do I find stocks correlated with a specific ticker?▼

Provide a single ticker like NVDA and the skill builds a peer universe of 15-30 same-sector stocks using the yfinance Screener API, then ranks them by Pearson correlation of daily log returns over a one-year lookback.

How to calculate correlation and beta between two stocks in Python?▼

Download adjusted close prices with yfinance, compute daily log returns, then use pandas corr() for Pearson correlation and the covariance ratio for beta. The skill also reports R-squared, rolling 60-day correlation, and spread Z-score.

Does this stock correlation analysis work on Claude.ai and Claude Code?▼

Yes, it works on all platforms including Claude Code and Claude.ai with code execution. It requires Python 3.8+ and auto-installs yfinance, pandas, and numpy via pip if they are missing.

What happens if scipy is not installed for correlation clustering?▼

Scipy is optional and only used for hierarchical clustering in the sector clustering mode. If scipy is unavailable, the skill falls back to sorting tickers by average correlation instead of clustering.

What are the limitations of historical stock correlation analysis?▼

Correlation is not causation, and past correlation does not guarantee future co-movement since market regimes shift. Short lookback windows produce noisy estimates, and correlations often spike toward 1 during market sell-offs.