I know this questions is a bit ambiguous, but I guess that's natural. To put it simply: I have a universe of around 600 stocks. How do I find the top $n$ "most correlated" assets?

At the moment I'm using a spectral coclustering technique to pick the cluster with the highest average correlation. This works fine, but it doesn't give me any sort of control over the number of assets that I want to pick. It just doesn't feel right.

Is there a better way to do this?

Edit: in principle I am looking at absolute correlation, but in my case almost all assets have a positive correlation.


  • 1
    $\begingroup$ Suppose you have two portfolios with just 3 assets each. One portfolio has correlations 1, -1, -1 (i.e. two assets are 100% correlated to each other and -100% to the third one). The other portfolio has correlations .9, .9, .9. Which portfolio is "more correlated"? In other words, what criteria do you use to decide what's "more correlated"? $\endgroup$ Commented May 4, 2021 at 17:00
  • 1
    $\begingroup$ So, your metric that you seek to maximize is: sum(abs(rho))? $\endgroup$ Commented May 4, 2021 at 17:05
  • 1
    $\begingroup$ using this metric, for example 1, 0, 0 (two 100% correlated assets, one not correlated to anything) is "more correlated" then .5, .5, .5. But if you use instead sum(sqrt(abs(rho)) (because - why not?), this changes. Perhaps if you ponder why you want this, you'll come up with a more natural measure. $\endgroup$ Commented May 4, 2021 at 17:23
  • 1
    $\begingroup$ Just thinking out loud: as long as you use sum(), you can view your stocks as nodes in a complete graph, and whatever measure you sum() as edge weight and , and look for a subgraph with maximum weight and given number of nodes. This may possibly turn out to be one of the variants of Steiner tree en.wikipedia.org/wiki/Steiner_tree_problem . solvable in ploynomial time (I don't know, but I would try this approach). $\endgroup$ Commented May 4, 2021 at 21:04
  • 2
    $\begingroup$ Thanks to Dimitri for some good comments. Also, whatever method you do use, keep in mind that correlations can be unstable so the time frame over which you choose to calculate the correlations is going to effect the result quite a bit also. $\endgroup$
    – mark leeds
    Commented May 4, 2021 at 22:25

2 Answers 2


Given the question text, my reply would be:

  1. Compute the correlation between all (or just a random subset, if 600^2 computations is too much) pairs of stocks.
  2. Sort the pairs, and choose stocks from the top until you have n distinct ones.

It would help to state what you are trying to achieve.

  • Is it to pick stocks representative of the market? If so, you might want an index fund, being cheaper to trade.
  • Are you trying to do arbitrage? Keep in mind that correlations can break down, especially when economics change (like during this pandemic).

You could treat your problem as an optimization problem, which would give you control over what to optimize and what constraints to add. Personally, I'd use an optimization heuristic to solve it. The downside is that you may have to do some programming yourself. See for instance this tutorial about heuristics (which I have written).

A code example for a similar question is here: Find k of n assets that "minimize" the correlation matrix You would only need to adjust the objective function.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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