Are there any online tools (optionally with developer API, to spare me the scraping) that given an existing portfolio, calculate how well a new candidate position would score to increase combined diversification/decrease risk?**

Or perhaps Linux tools that given parameters, can look up historical prices and whatever else they need to for instance return correlation values of individual positions relative to the rest (of that portfolio only, not the broader market or sector)? Beancounter was a great start.

Okay, I realize this may be vague, but I am also open-minded. My goal is to reduce correlations. For example if I already own SPY, then buying IWM (or shorting SDS) would be a poor choice for a new position, as this chart shows.

A tool that computes covariances? of each equity pair in a portfolio, then the combined portfolio variance plus some other aggregate stats based on those, would be nice.

A little bit more background perhaps. Using only very basic investment concepts I have built a process that, at the highest level, uses quantifiable fundamental analysis to screen out the universe of stocks and ETFs. Including market_cap, analyst_recom, average_volume, dividend_yield, P/E, Insider & Inst Own %s, to name a few.

Also daily at a lower level I further filter out candidates using more technical analysis, like short-term RSIs and performances, volatilities, exponential or simple_moving_averages, and average_true_range. (OK some are more for computing trade trigger parameters)

Somewhere in between, I'm looking to introduce criteria that actually considers the rest of the present portfolio and its positions' market values.

I found some websites like Correlation Analysis that take a stock basket to show a correlation matrix and some kind of Intra-portfolio diversification which is key. However that one doesn't factor in number of shares or size of each position.


Maybe I don't get your question well, but what it appears that your goal is to buy securities in order to reduce the correlation between your portfolio constituents.

So firstly you need a metric of diversification.

Something simple you can use, is calculate the correlation matrix, and the weights of each position.

A simple metric would be the sum of (correlation *((size pos 1 + size pos 2) /size(portfolio))

This would give you a sort of weighted average correlation (WAC)

Now you would need to compare previous WAC to new WAC for each potential security and buy only securities that give you a lower WAC.

Another twist if you want to add a dimension of correlation aversion would be the sum of squared correlation (make sure your coefficients are stated as numbers > 0, otherwise they will get smaller! and remember to keep the negative sign at the end (if applicable) so your "diversification effects" are present).

Also remember that correlations are time dependent during market crashes this will increase. So you will need to adjust your sampling window according to your holding period.

  • $\begingroup$ Yeah something like that. You mean a matrix like ones at assetcorrelation.com/custom?period=91&portfolio=1648 ? Only I don't get your formula yet for the case of N existing positions. I do want the WAC to factor in the sizes(each position different) so that seems like the right track. $\endgroup$ – Marcos Mar 8 '12 at 23:56
  • $\begingroup$ Sorry, I should have made it more clear, the forumala is the sum across all pairs, on the matrix in that site, that has all the pairs so to do a simple example with ADC and ACPW, it would be (0.26)*(size(ADC)+size(ACPW))/size(portfolio), then you would repeat this for every pair and taking the sum to get the WAC $\endgroup$ – Kyle Balkissoon Mar 9 '12 at 13:16
  • $\begingroup$ I think I see. So for the 16 positions in that example, the final WAC would be the sum of the 15 + 14 + 13 + ... 2 + 1 = 16^2 /2 or 128 possible pairs applied into that formula. $\endgroup$ – Marcos Mar 9 '12 at 20:05
  • $\begingroup$ So to incorporate this into my process, basically I need to 1. Gauge the correlations between each pair of existing positions once at the beginning and remember the initial WAC, next 2. For each new candidate, learn from somewhere its correlations with each of the positions in the portfolio, and finally 3. Run the correlation matrix sum again as if the candidate already belonged to the portfolio, and see how it changed the WAC up or down from the original--down meaning less aggregate correlation(less risk). $\endgroup$ – Marcos Mar 9 '12 at 20:13
  • $\begingroup$ Yes, 1. Calculate the correlation matrix with the current positions. 2. Calculate the weights of each pair. 3. Calculate the WAC. 4. Recalculate Correlation matrix with new position 5. Recalculate weight pairs with new position 6. Calculate WAC' if WAC'>WAC reject. You can use an optimizer to find out what quantity if any will decrease the WAC, however if you wanted to simply avoid correlations whether +ve or negative, you would just take the absolute value of the correlations. $\endgroup$ – Kyle Balkissoon Mar 10 '12 at 18:21

To address this top-down, what you're really trying to do is achieve consistent returns. The conventional wisdom approach to doing this is to find portfolio constituents that provide diversification and the conventional approach to doing this is to find constituents that have returns that are uncorrelated with each other. But the conventional way of doing this quantitatively leads to low predictability that future returns will match past returns. We did substantial research on this in the late 1980s and the result of that research led us to create portfolios that were balanced and diversified across multiple "return drivers.' This also has the benefit of increasing the probability that your portfolio's returns will achieve a specific target return.

I write about this in my book "Jackass Investing: Don't do it. Profit from it." You can see more at www.JackassInvesting.com"

  • $\begingroup$ I appreciate the professional insight and tend to agree with some of the concepts and myths discussed in your book. However can you point me to areas specific to diversification- or portfolio-correlation- testing strategies to help me navigate the material you published, online(preferably) or offline? $\endgroup$ – Marcos Mar 10 '12 at 13:17

This is an old question but considering there isn't an accepted answer, I suggest you have a look at DiversifyPortfolio. They provide various tools and visualizations related to correlation and stock portfolio diversification.

They also provide a portfolio allocation tool which takes position sizes and portfolio position correlations into account when determining optimal position sizes.


You can calculate correlations, volatility, beta and other statistical metrics for a multi-holdings portfolio on InvestSpy, which is free of charge. For example, analyzing an evenly weighted portfolio of sector ETFs, it's clear that different sectors carry very different levels of risk. At the first glance, Health Care (XLV), Consumer Staples (XLP) and Utilities (XLU) appear to be the best diversifiers, whilst Financials (XLF) and Energy (XLE) - the worst. Similar analysis could be applied at a country level.

  • 1
    $\begingroup$ Are you serious?! I just deleted another InvestSpy spam post this morning. You and your colleague (Marius) both have't explained anything about the techniques involved in this. We aren't a forum for advertising. $\endgroup$ – chrisaycock Feb 20 '13 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.