The aim of the project was to find a pair of stocks sharing the common trend in such a way that a linear combination of two series would be stationary, which is so-called co-integration. The underlying logic of Pairs Trading is to monitor movements of cointegrated stocks and to look for trading opportunities when the divergence presents. Under the mean-reversion assumption, the stock price would tend to move back to the long-term equilibrium. As a result, the spread between two co-integrated stock prices would eventually converge. Furthermore, given the stationarity of the spread between co-integrated stocks, it becomes possible to forecast such spread with time series models.
The pair trading strategy includes looping over the stock pairs, extract two stock prices and estimate parameters. Next, we check the stationarity of that by using a special function that returns the result of two types unit root test. Then we create the trading signal using the estimated spread.
Published:May 14, 2020