In this post I introduce a basic workflow used to develop a quantitative trading strategy. We’re going to collect data on ‘FAANG’ stocks(Facebook, AAPL, AMZN, NFLX, and GOOG) and look for statistical significance in the underlying equities. We will then use this to base our hypothesis and develop a backtest of a quantitative trading strategy.
Once I collected the data, I initially wanted to take a look at the time series of each of these stocks.
After getting a general idea of the performance of the stocks, I then decided to take a look at the return profiles of each underlying. Here my primary interest included understanding the typical intraday volatility as to develop grounds to better understand the risk associated with each underlying.
From looking at the above plot, it appears that NFLX is clearly the most volatile of the group. I decided to dig a little deeper and thus plotted each equity’s daily return profile separately for individual analysis.
From looking at the plots of the individual equities, it can be seen that while NFLX is prone to some intraday price swings, the remaining equities are also prone to some, at times, more volatile intraday moves than NFLX. I furthered my analysis by calculating the standard deviations of returns for each of the stocks. Over the sample, Facebook’s standard deviation was 0.024, Apple’s was 0.016, Amazon’s was 0.0199, Netflix’s was 0.035, and Google’s was 0.015. Based on assessing the standard deviations of the daily returns for each, NFLX, with a standard deviation of 3.5% is clearly the more volatile stock.
As can be seen from the plot below, on a rolling standard deviation basis, NFLX again has been the more volatile stock intraday on a historical basis, but in more recent time, the stock, though still the most volatile, others in the group have somewhat closed the gap.
Now I’m ready to begin assessing the group to determine what relationships exist between each of the underlying stocks. I begin by looking at the group as whole.
At this point, I’m now looking for unique relationships within the group. It is a natural expectancy that the group be correlated to a degree. However, what I was really interested in was uncovering where any unique relationships between any two of the group really stood out from the consensus notion of all ‘FAANG’ stocks being correlated. After looking through the pairplot, which is a good function to get an overview of a data set, AMZN was the first row to really standout. The stock was positively correlated with the group but its correlation to Facebook and Google were the two that really jumped out. Moving on to Facebook’s row, after Amazon, Google appeared to have the strongest relationship to the stock. Moving to Google, Amazon then Facebook, appeared to have the strongest correlations. Lastly, surveying Netflix, each of the remaining stocks appeared to be roughly equally correlated with Netflix.
At this point, I believe that I know which pairs I’d like to take a deeper look at, but to further my analysis a bit more, I created a heatmap of the correlations of the underlying stocks.
The heatmap was a bit surprising, which is a good thing. It’s always desirable to seek to back-up your assumptions quantitatively. Before creating the heatmap, it appeared that Amazon’s strongest correlation was with Facebook, with Google coming in second. The heatmap of the correlations actually revealed that it was the other way around. Amazon’s strongest correlation has been to Google, with Facebook coming in second. My initial belief about Facebook was that it was most strongly correlated to Amazon with Google coming in second. Assessing the heatmap, yet again the actual numbers were inverted as Facebook has been most closely correlated with Google, with Netflix coming in second. On to Google, my initial belief was that Amazon had the strongest correlation followed by Facebook. After reviewing this assumption via the heatmap, it too was inverted with the strongest relationship being between Facebook and Amazon coming in second. Lastly, regarding Netflix, it was believed that this stock’s closest relationship was on balance equal to the remaining stocks in the group. This was a fair assumption as Netflix’s correlation to Amazon, Facebook, and Google, came in at .94, .95, and.94 respectively. However,take a look at its correlation to Apple, which came in at .81, and is the second lowest correlation between any two stocks in the group.
Based on this analysis, I must update my original hypothesis, and seek to design a quantitative strategy based on what this exercise has told me comprehensively. At this point, we’re still not quite ready to begin designing a trading strategy and backtesting it as there is yet some additional analysis that must be conducted, but we do have a better understanding about the group that will serve as a foundation for our continued analysis and later our strategy backtest.
Read Quantitative Trading: FAANG Example Part II