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 partners", "correlation matrix", "co-movement", "related tickers", "sympathy plays", "semiconductor peers", "hedging pair", "realized correlation", "rolling correlation", or any request about stocks that move in tandem or inversely. Also triggers for well-known pairs like AMD/NVDA, GOOGL/AVGO, LITE/COHR. If only one ticker is provided, infer the user wants correlated peers.

Install

Hot:171

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=himself65-skills-stock-correlation&locale=en&source=copy

Stock Correlation - Stock Correlation Analysis Skill

Skill Overview


Stock Correlation is a professional stock correlation analysis tool that helps investors discover interlinking relationships between stocks. It identifies related companies and potential trading pairs, supporting single-stock co-movement discovery, cross-comparison of multi-stock correlations, sector clustering analysis, and time-varying correlation research.

Use Cases

1. Find Related Stocks and Sympathy Trading Opportunities


When you hold or follow a particular stock (e.g., NVIDIA NVDA) and want to know which other stocks may move in sync with it, this skill helps you find companies in the same industry, upstream/downstream in the supply chain, or with business relationships. It is suited for finding “sympathy trading” opportunities—when a leading stock moves sharply due to earnings reports or news, its related stocks often follow.

2. Pair Trading Strategy Research


Pair trading relies on two stocks that have been historically highly correlated. This skill calculates the correlation coefficient, beta, R-squared, and the price spread’s Z-score between two stocks. It helps you identify stock pairs suitable for pair trading and spot entry opportunities when the spread deviates from its mean.

3. Portfolio Risk Management and Diversification


By analyzing the correlation matrix among your holdings, you can identify concentration risk in your portfolio. Highly correlated stocks may decline in sync when the market falls, reducing diversification benefits. This skill supports sector clustering analysis, helping you discover assets with lower correlations to optimize portfolio allocation.

Core Features

1. Co-Movement Discovery


Enter a single stock ticker. The skill dynamically builds a candidate pool (15–30 stocks) consisting of stocks in the same industry, same sector, and related industries. Then it computes their historical correlation with the target stock and sorts them by correlation strength. The results include the correlation coefficient, company name, and an explanation of the relationship (e.g., “Same industry—GPU/CPU,” “AI infrastructure peers”).

2. In-Depth Return Correlation Analysis


For two or more specific stocks, it provides detailed relationship analysis, including:
  • Pearson correlation coefficient

  • Beta value (B): volatility sensitivity of B relative to A

  • R-squared (goodness of fit)

  • 60-day rolling correlation statistics (mean, range, standard deviation)

  • Spread analysis and the current Z-score (to identify mean-reversion opportunities)
  • 3. Time-Varying Correlation (Realized Correlation)


    Correlation is not constant. This feature shows how correlation changes over time, including rolling correlations over multiple windows (20 days, 60 days, 120 days) and correlation comparisons under different market conditions (up days, down days, high-volatility periods, and during large drawdowns). This is crucial for risk control—under market stress, correlations often approach 1, which can cause diversification strategies to fail.

    4. Sector Clustering Analysis


    Enter a set of stock tickers. The skill generates a full correlation matrix, uses hierarchical clustering to identify groups of stocks, highlights the strongest correlated pairs and the weakest correlated pairs (potential hedging targets), and finds outlier stocks that have low correlation with the group (diversification candidates).

    Frequently Asked Questions

    What is stock correlation? How do I interpret the correlation coefficient?


    Stock correlation measures how synchronously two stocks’ prices move, with values ranging from -1 to +1. +1 indicates perfect positive correlation (move together up and down), -1 indicates perfect negative correlation (one rises while the other falls), and 0 indicates no correlation. Generally:
  • > 0.80: Strong correlation—stocks move very synchronously

  • 0.50–0.80: Moderate correlation—shared sector drivers, but each has independent factors

  • < 0.50: Weak correlation—limited linkage
  • What does a high correlation between two stocks mean?


    High correlation means the two stocks tend to move together. This can have several causes: same industry (e.g., AMD and NVDA are both semiconductors), supply-chain relationships, shared major customers, or similar business models. However, correlation does not imply causation, and historical correlation does not guarantee it will persist. Also, during market stress, correlation often rises (“correlation tends toward 1 in crises”).

    Can stock correlation analysis be used for pair trading?


    Yes. Pair trading looks for stock pairs that were historically highly correlated but currently have abnormal spreads. The correlation coefficient, beta value, and spread Z-score provided by this skill are key indicators for pair trading. When the Z-score exceeds ±2, it may indicate an abnormal spread and potential mean-reversion opportunity. Please note: this is a research and educational tool and does not constitute investment advice.

    What data source does this skill use?


    This skill uses historical price data from Yahoo Finance, retrieved via Python’s yfinance library. The data includes daily closing prices, with a default analysis period of one year, which can be adjusted as needed. Yahoo Finance data is for reference only and does not guarantee accuracy or completeness.

    Why are some stocks sometimes excluded from the analysis?


    Stocks may be excluded for reasons such as insufficient data (fewer than 60 valid trading days), delisting, no data available on Yahoo Finance, or excessive suspension time during the analysis period. The skill automatically filters out stocks with poor data quality to ensure the reliability of the results.

    What’s the difference between rolling correlation and fixed correlation?


    Fixed correlation uses the entire analysis period to compute a single correlation coefficient, reflecting the average relationship. Rolling correlation (e.g., 60-day rolling) uses a moving window to show how correlation changes over time. If the rolling correlation’s standard deviation is high, it indicates the relationship is unstable, increasing the risk of pair trading.

    What are the limitations of correlation analysis?


    Key limitations include:
  • Hindsight bias: historical correlation does not ensure future persistence

  • Nonlinear relationships: Pearson correlation only captures linear relationships

  • Lag effects: some stocks may have lagged correlations (A leading B)

  • Regime shift: changes in market structure can alter correlation patterns

  • Small-sample bias: short-window analysis may include noise
  • What type of investors is this skill suitable for?


    It is suitable for investors interested in quantitative analysis, risk management, and trading strategies, including:
  • Active traders looking for sympathy trading opportunities

  • Quantitative traders building pair trading strategies

  • Asset managers focusing on portfolio diversification

  • Financial analysts studying sector relationships

  • Students and researchers learning correlation analysis
  • This skill is for research and educational purposes only and does not constitute investment advice or a recommendation.