Normally, if you wanted to go long oil, you might buy an energy sector ETF or buy oil stocks. But it’s possible that those stocks may not be available or that they are not available at a high volume. Or maybe you just want to find a less commonly used and less crowded ways to invest. What are some things that can be done with those restrictions?
One question you might ask is “What stocks have similar price movements to oil when we discount the index and sector?” This question can be answered in Palantir in a few steps. To do so, we’ll first use regressions on every stock in the S&P 500 to take out the movements of the S&P 500 and that stock’s sector ETF. Then, we’ll correlate the resulting residuals to the daily percent change of oil and look at a distribution across all 500 stocks. Next, we’ll select the ones with the highest correlation and create an index that tracks the stocks over time. Lastly, we’ll compare this index with an oil trust to see how they compare.
Removing market and sector movements
The first thing we need to do is “clean” our stock’s returns. The best way to remove the S&P 500 and sector price movements is to do regressions of our stock against the targets and use the residual as our new series. What this basically does is remove the parts of returns that can be explained by the S&P 500 and the stock’s sector and leaves us with what we’re interested in: the movements that don’t fall into one of those two categories.
Here’s an example of how you’d do so using Palantir Finance, a metric called “removeMarketSector”. This metric becomes built into the system and we will use it in other applications, notably Instrument Explorer and Chart.
Note that all the regressions are done in daily percent changes, and by default the regression is run over the past year.
The resulting time series after removing Google’s market and sector movements is shown below. Visually, we can see that the movements are now much smaller in magnitude, but we can also quantify this by taking the moving average of the absolute value of the daily percent changes. The bottom chart (brown) shows that the magnitude after removing the price effects is anywhere 25% to 50% less than before.
Looking at the S&P 500
But we want to look at this cross-sectionally. To do so, we’ll jump to Instrument Explorer and apply our “removeMarketSector” metric to all S&P 500 stocks and correlate the result with Oil’s movements.
We’ll evaluate this query as of 1 year ago (the end of August 2008), find the stocks that pass our criteria, and create an Index that tracks from that date until today. This will give us a truly out of sample view of our criteria to see how well our methodology works.
Here is 6-month correlation of our stocks (after removing market and sector movements) to oil as of August 2008. By selecting the buckets with the highest absolute value of correlation coefficient, we can see which stocks best describe the movements of oil. The GICS sector is listed next to each stock below.
Only two of the 11 highly correlated stocks are from the energy sector. This gives us a good base for which stocks to choose from when trying to find an alternative for oil.
Creating a tracking Index
Now we’ll create our Index. It will take the 11 stocks listed above and track them for 1 year on an equal weighted basis. We’ll rebalance our Index every month and go short the stocks that are negatively correlated in our group.
Comparing our results
Finally, we’ll compare this to USO, an Oil ETF. We’ll look at the monthly returns of each series over the past year. The orange bars are the monthly returns of USO and the green dots are the returns of our Index.
Looking at this more carefully, all but two months (December 2008, April 2009) saw our Index move in the same direction as USO.
The results here are fairly good but they can be improved upon. A quick extension in Palantir would be to create a dynamic Index rather than a static Index and instead choose new stocks on every rebalance day. This would allow us to adjust our Index to keep track of the most recent price movements.