Revealing the hidden structure of the stock market with correlation heatmaps

If a normal picture is worth a thousand words, a correlation heatmap worth a billion

The stock market offers a bewildering array of individual stocks to trade. Understanding the complex interrelationships between different stocks is a harder task still. Even if you narrow your trading universe to the components of the S&P 500 index, keeping track of everything is a herculean undertaking.

One of the tools traders use to make sense of the stock market is the concept of clustering. Intuitively, even though each stock is unique they all share some common risk factors. Stocks can be clustered by country, sector,  business model, market cap or a variety of measures.

With the rise of high frequency trading, the most important clustering method has become price correlation. This method allows us to group stocks by the similarity of their price movements. This shows a hidden structure to the markets. The chart below is a clustered correlation heatmap for the components of the S&P 500. The red cells are the most correlated, white cells are uncorrelated, and blue cells are anti-correlated (the stock pairs move in opposite directions).

Stocks within the same cluster have a tendency to trade in a herd. Some traders like to buy the strongest stock within a cluster, which is very similar to the technical analysis concept of relative strength. Traders will often buy the strongest stock and sell the weakest stock within the cluster, establishing a “market neutral” position that will profit regardless of the direction of the overall stock market. 

Sometimes this process overextends itself and traders want to do the opposite: sell strength and buy weakness. This is another way to be market neutral. Stocks that are highly correlated are optimal choices for this form of statistical arbitrage, or “pairs trading”, whereby you trade the relative value of two highly correlated stocks. When one stock is rich relative to another stock, the rich stock is simultaneously sold and the cheap bought. If the relationship comes back into line, the position is closed at a profit.

The correlation heatmap below is 9000 x 9000 pixels. It is meant to be explored close up and mined visually for opportunities. The stock pairs with the highest correlation are on the red spectrum. Anti-correlated pairs appear blue, and uncorrelated pairs white. Note the pronounced absence of blue pairs. Stocks are becoming very highly correlated 

S&P 500 Correlation Heatmap

Click to explore a 9000 x 9000 pixel correlation heatmap of the S&P 500

7 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s