jacobhsu/cc-finance-skills/stock-correlation
Claude Code and agent skill by jacobhsu/cc-finance-skills
- community
Checking that the SKILL.md file is still in the repository.
Analyze stock correlations to find related companies and trading pairs. Use this skill whenever the user asks about correlated stocks, related companies, sector peers, trading pairs, or how two or more stocks move together. Triggers include: "what correlates with NVDA", "find stocks related to AMD", "correlation between AAPL and MSFT", "what moves with", "sector peers", "pair trading", "correlated stocks", "when NVDA drops what else drops", "find me a pair for", "stocks that move together", "beta to", "relative performance", "which stocks follow AMD", "supply chain partners", "correlation matrix", "co-movement", "related tickers", "sympathy plays", "if GOOGL moves what else moves", "semiconductor peers", "compare correlation", "hedging pair", "sector clustering", "realized correlation", "rolling correlation", or any request about finding stocks that move in tandem or inversely. Also triggers when the user mentions well-known pairs like AMD/NVDA, GOOGL/AVGO, LITE/COHR and wants to understand or find similar relationships. Always use this skill even if the user only provides one ticker — infer that they want to find correlated peers.
Install
npx vskill@latest install jacobhsu/cc-finance-skills/stock-correlationSKILL.md
The same SKILL.md was published earlier as sapiens-ostracism678/finance-skills/stock-correlation.
Stock Correlation Analysis Skill
Finds and analyzes correlated stocks using historical price data from Yahoo Finance via yfinance. Routes to specialized sub-skills based on user intent.
Important: This is for research and educational purposes only. Not financial advice. yfinance is not affiliated with Yahoo, Inc.
Step 1: Ensure Dependencies Are Available
Current environment status:
If DEPS_MISSING, install required packages before running any code:
If all dependencies are already installed, skip the install step and proceed directly.
Step 2: Route to the Correct Sub-Skill
Classify the user's request and jump to the matching sub-skill section below.
| User Request | Route To | Examples | |
|---|---|---|---|
| Single ticker, wants to find related stocks | Sub-Skill A: Co-movement Discovery | "what correlates with NVDA", "find stocks related to AMD", "sympathy plays for TSLA" | |
| Two or more specific tickers, wants relationship details | Sub-Skill B: Return Correlation | "correlation between AMD and NVDA", "how do LITE and COHR move together", "compare AAPL vs MSFT" | |
| Group of tickers, wants structure/grouping | Sub-Skill C: Sector Clustering | "correlation matrix for FAANG", "cluster these semiconductor stocks", "sector peers for AMD" | |
| Wants time-varying or conditional correlation | Sub-Skill D: Realized Correlation | "rolling correlation AMD NVDA", "when NVDA drops what else drops", "how has correlation changed" |
If ambiguous, default to Sub-Skill A (Co-movement Discovery) for single tickers, or Sub-Skill B (Return Correlation) for two tickers.
Defaults for all sub-skills
| Parameter | Default | |
|---|---|---|
| Lookback period | 1y (1 year) | |
| Data interval | 1d (daily) | |
| Correlation method | Pearson | |
| Minimum correlation threshold | 0.60 | |
| Number of results | Top 10 | |
| Return type | Daily log returns | |
| Rolling window | 60 trading days |
Sub-Skill A: Co-movement Discovery
Goal: Given a single ticker, find stocks that move with it.
A1: Build the peer universe
You need 15-30 candidates. Do not use hardcoded ticker lists — build the universe dynamically at runtime. See references/sector_universes.md for the full implementation. The approach:
- Screen same-industry stocks using
yf.screen()+yf.EquityQueryto find stocks in the same industry as the target - Broaden to sector if the industry screen returns fewer than 10 peers
- Add thematic/adjacent industries — read the target's
longBusinessSummaryand screen 1-2 related industries (e.g., a semiconductor company → also screen semiconductor equipment) - Combine, deduplicate, remove target ticker
A2: Compute correlations
A3: Present results
Show a ranked table with company names and sectors (fetch via yf.Ticker(t).info.get("shortName")):
| Rank | Ticker | Company | Correlation | Why linked | |
|---|---|---|---|---|---|
| 1 | AMD | Advanced Micro Devices | 0.82 | Same industry — GPU/CPU | |
| 2 | AVGO | Broadcom | 0.78 | AI infrastructure peer |
Include:
- Top 10 positively correlated stocks
- Any notable negatively correlated stocks (potential hedges)
- Brief explanation of why each might be linked (sector, supply chain, customer overlap)
Sub-Skill B: Return Correlation
Goal: Deep-dive into the relationship between two (or a few) specific tickers.
B1: Download and compute
B2: Present results
Show a summary card:
| Metric | Value | |
|---|---|---|
| Pearson Correlation | 0.82 | |
| Beta (B vs A) | 1.15 | |
| R-squared | 0.67 | |
| Rolling Corr (60d avg) | 0.80 | |
| Rolling Corr Range | [0.55, 0.94] | |
| Rolling Corr Std Dev | 0.08 | |
| Spread Z-Score (current) | +1.2 | |
| Observations | 250 |
Interpretation guide:
- Correlation > 0.80: Strong co-movement — these stocks are tightly linked
- Correlation 0.50–0.80: Moderate — shared sector drivers but independent factors too
- Correlation < 0.50: Weak — limited co-movement despite possible sector overlap
- High rolling std: Unstable relationship — correlation varies significantly over time
- Spread Z > |2|: Unusual divergence from historical relationship
Sub-Skill C: Sector Clustering
Goal: Given a group of tickers, show the full correlation structure and identify clusters.
C1: Build the correlation matrix
Note: if scipy is not available, fall back to sorting by average correlation instead of hierarchical clustering.
C2: Present results
- Full correlation matrix — formatted as a table. For more than 8 tickers, show as a heatmap description or highlight only the strongest/weakest pairs.
- Identified clusters — group tickers that have high intra-group correlation:
- Cluster 1: [NVDA, AMD, AVGO] — avg intra-correlation 0.82
- Cluster 2: [AAPL, MSFT] — avg intra-correlation 0.75
- Outliers — tickers with low average correlation to the group (potential diversifiers).
- Strongest pairs — top 5 highest-correlation pairs in the matrix.
- Weakest pairs — top 5 lowest/negative-correlation pairs (hedging candidates).
Sub-Skill D: Realized Correlation
Goal: Show how correlation changes over time and under different market conditions.
D1: Rolling correlation
D2: Regime-conditional correlation
D3: Present results
- Rolling correlation summary table:
| Window | Current | Mean | Min | Max | Std | |
|---|---|---|---|---|---|---|
| 20-day | 0.88 | 0.76 | 0.32 | 0.95 | 0.12 | |
| 60-day | 0.82 | 0.78 | 0.55 | 0.92 | 0.08 | |
| 120-day | 0.80 | 0.79 | 0.68 | 0.88 | 0.05 |
- Regime correlation table:
| Regime | Correlation | Days | |
|---|---|---|---|
| All Days | 0.82 | 250 | |
| Up Days | 0.75 | 132 | |
| Down Days | 0.87 | 118 | |
| High Vol (top 25%) | 0.90 | 63 | |
| Large Drawdown (< -2%) | 0.93 | 28 |
- Key insight: Highlight whether correlation increases during sell-offs (very common — "correlations go to 1 in a crisis"). This is critical for risk management.
- Trend: Is correlation trending higher or lower recently vs. its historical average?
Step 3: Respond to the User
After running the appropriate sub-skill, present results clearly:
Always include
- The lookback period and data interval used
- The number of observations (trading days)
- Any tickers dropped due to insufficient data
Always caveat
- Correlation is not causation — co-movement does not imply a causal link
- Past correlation does not guarantee future correlation — regimes shift
- Short lookback windows produce noisy estimates; longer windows smooth but may miss regime changes
Practical applications (mention when relevant)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/stock-correlation/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jacobhsu/cc-finance-skills/stock-correlation)