Monitoring Weighted Average Correlation in a Stock Portfolio
Summary
The document explains ways to monitor how strongly a stock portfolio moves as a group. It distinguishes a simple average of pairwise correlations from a portfolio-level measure derived from variance. One approach computes portfolio return variance from asset weights, individual volatilities, and pairwise correlations; another rearranges that relationship to estimate a weighted average correlation from portfolio and constituent variances. Using actual portfolio weights makes the metric reflect the holdings, while equal weights provide a different comparison.
The example asks about three stocks and daily returns, but the responses do not work through those specific figures. They suggest recalculating the measure over a rolling period to track changes, with one response describing a weekly calculation based on roughly a month of daily observations. This is a rough diversification monitor: portfolio variance also depends on each asset's volatility, so it is not a pure measure of correlation alone. The discussion mentions Python resources but does not provide an implementation or validate a particular package.
Key ideas
- Portfolio variance combines asset weights, individual volatilities, and pairwise correlations.
- A portfolio-level average correlation can be derived from portfolio variance and constituent variances.
- Using actual holdings weights makes the metric specific to the portfolio being monitored.
- Rolling calculations can show how the relationship among holdings changes over time.
- Portfolio variance reflects both volatility and correlation, so it is not a correlation-only measure.
Tags
Full text
# correlation for portfolio of stocks
# correlation for portfolio of stocks
I have a portfolio of stocks and all I want to do is to make sure that I'm not trading one big position, so I would like to monitor some type of metric that gives me a rough idea of what the overall correlation in the portfolio is and how it is changing day to day thru movement in prices. I want to get it down to one number a day, but I'm not sure how to do it. let's say I have three stocks `a,b,c`. Do I just take the correlation between `a` and `b`, `b` and `c`, `a` and `c`, then average it? What is the correct way to do it?
Would it be possible to give a simple example? Let's say a,b,c stocks and the weights are 20%,30%,50% respectively. The 3 day daily returns are
```
day a b c
1 0% 2% 2%
2 1% -1% 0%
3 2% 1% 0%
```
How do I apply your formula?
And also just curious is there a package in python that does these calculation for you? I imagine I'm asking a pretty standard question, one would think it is a pre-package solution in a library somewhere. Would `pandas` have something?
## Answer by vonjd (score 3, accepted)
https://quant.stackexchange.com/a/16763
I think you might be looking for the portfolio return variance: $$\sigma_p^2 = \sum_i \sum_j w_i w_j \sigma_i \sigma_j \rho_{ij},$$ where $\rho_{ij}$ is the Pearson product-moment correlation coefficient between the returns on assets $i$ and $j$ and $\rho_{ij} = 1$ for $i=j$.
In your case you could either weigh the assets equally or according to the real weights in your portfolio and recalculate that metric daily.
Generally, the lower the correlation between securities in your portfolio, the lower the portfolio variance - which is what you intend to measure.
Edit Since I do not work with python I did a quick google-search and found the following relevant question/answer how to actually do the calculation in python: https://stackoverflow.com/questions/7409108/portfolio-variance-of-a-portfolio-of-n-assets-in-python
## Answer by WaltS (score 2)
https://quant.stackexchange.com/a/16779
In their paper on their S&P 500 Implied Correlation Index the CBOE has defined a measure for the market-capitalization weighted average correlation of the S&P 500 index which could be applied to portfolios in general. The equation
$$ \rho_{av} = \frac{\sigma^2 - \sum_{i=1}^N w_i^2\sigma_i^2}{2 \sum_{i=1}^N \sum_{j>i}^N w_i w_j \sigma_i \sigma_j} $$
has also been discussed in this post on this forum. Like the correlation between two-assets, this correlation approaches one when all assets become correlated (e.g. market crashes) and decreases and can even become negative as assets become less correlated. I've found computing it on a weekly basis using the past month's daily data can be useful for monitoring relatively short-term changes in long-only portfolio correlation.
I don't know of a published implementation of this equation but it's straightforward to code it in R.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.