stock-correlation
Analyze stock correlations to find related companies and trading pairs. Use when the user asks about correlated stocks, related companies, sector peers, trading pairs, or how two or more stocks move together. Triggers: "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", "stocks that move together", "beta to", "relative performance", "supply chain
Security Assessment
About stock-correlation
This skill analyzes stock correlations to find related companies and trading pairs, using historical price data from Yahoo Finance via the yfinance library. It solves the problem of discovering which stocks move together (or inversely) — sector peers, sympathy plays, supply-chain partners, and hedging pairs — and quantifying those relationships. The documentation is explicit that it is for research and educational purposes only and is not financial advice.
The skill first checks whether yfinance, pandas, and numpy are available and installs them via pip only if missing, then routes the request to one of four sub-skills. Co-movement Discovery takes a single ticker, dynamically builds a 15-30 candidate peer universe using yfinance screeners (`yf.screen()` with `yf.EquityQuery`, broadened by sector and adjacent industries rather than hardcoded lists), computes daily log-return correlations, and presents a ranked table with company names, sectors, and a plain-English rationale for each link. Return Correlation deep-dives two or more tickers, reporting Pearson correlation, beta, R-squared, rolling 60-day correlation statistics, and a z-scored log-price spread for mean-reversion. Sector Clustering groups a set of tickers into a correlation matrix or clusters, and Realized Correlation handles time-varying and conditional (for example downside) correlation. Sensible defaults are documented: a one-year daily lookback, Pearson method, a 0.60 minimum correlation threshold, top-10 results, log returns, and a 60-day rolling window.
Target users are retail and quantitative investors, analysts, and researchers exploring co-movement, pair trading, hedging, and sector structure. All data access is read-only market data; the only system action is installing standard Python data-analysis packages when they are absent.
FAQ
Where does the data come from and what are the dependencies?
Historical price data comes from Yahoo Finance via the yfinance library, with pandas and numpy for analysis. The skill checks for these and installs them via pip only if they are missing. yfinance is not affiliated with Yahoo, Inc.
What kinds of analysis can it do?
Four modes: co-movement discovery from a single ticker, detailed return correlation between two or more tickers (correlation, beta, R-squared, rolling correlation, spread z-score), sector clustering / correlation matrices, and realized or rolling / conditional correlation over time.
What are the default analysis parameters?
A one-year lookback, daily interval, Pearson correlation, a 0.60 minimum correlation threshold, top-10 results, daily log returns, and a 60-day rolling window — all overridable.
Is this financial advice?
No. The skill explicitly states it is for research and educational purposes only and is not financial advice.
How does it choose peer candidates?
It builds the peer universe dynamically at runtime using yfinance screeners and EquityQuery — screening the same industry, broadening to sector if too few peers, and adding thematic/adjacent industries — rather than relying on hardcoded ticker lists.
Install stock-correlation
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
himself65/finance-skills