Investigating the Profitability of Pairs Trading using Machine Learning and Genetic based Algorithms in the Tehran Stock Exchange

Document Type : Article


1 Faculty of industrial and System Engineering. Tarbiat Modares University

2 Professor at Tarbiat Modare University

3 Faculty of Industrial and System Engineering



Algorithmic trading is the use of computers to adopt trading positions that are controlled by algorithms. Furthermore, algorithmic trading is executing orders to buy and sell securities based on decisions made by computer algorithms. One of the types of algorithmic trading is pair trading, which is one of the most common statistical arbitrage strategies. Pairs trading is one of the most valuable market neutral and market inefficiency-based strategies used by investors, and it is especially interesting because it overcomes the difficult process of valuing assets by focusing on relative pricing. By buying relatively undervalued security and selling a relatively overvalued security, one can benefit from the convergence of the price of the asset pair. However, as data access increases, it becomes more difficult to find rewarding and profitable pairs. In this paper, the issue of finding profitable pairs while limiting search space using machine learning techniques has been studied and the integration of an unsupervised learning algorithm, OPTICS, into the pairs selection process is proposed. Also, according to the way of forming a portfolio of asset pairs and allocating capital to it, portfolio optimization and allocating optimal weights to pairs is motivated and a genetic-based algorithm approach has been used to increase the sharp ratio. In this study, the results show that the proposed technique can work better than the common methods of creating search space to find pairs in pair trading and achieve an average rate of return on investment and a higher Sharp ratio for a portfolio than standard approaches and also the algorithm used to optimize the portfolio of pairs shows promising results in terms of profitability assessment criteria. The data of this work is related to different periods between 2015 and 2020, using intraday (15-minute) price data from a group of stocks on the Tehran stock exchange that is simulated considering transaction costs.