Application of Kalman Filter to Estimate Dynamic Hedge Ratio in Pairs Trading Strategy: A Case Study of the Automobile Industry

Document Type : Research Paper


1 , Assistant Prof., Department of Theoretical Economics, Faculty of Economics, Allameh Tabataba'i University, Tehran, Iran.

2 Ph.D., Department of Financial Engineering, Faculty of Economic, Management and Accounting, Yazd University, Yazd, Iran.


Objective: Pairs trading strategies have been around since the mid-1980s and have gained widespread acceptance in recent years. A pairs trading strategy is one of the forms of statistical arbitrage done to make a profit. It bases on the return related to the average spread between pairs of financial securities. The purpose of this research is to investigate the application of the Kalman filter to estimate the dynamic hedge ratio in the pairs trading strategy. The main question of this article is whether individual investors can make a profit by using this trading strategy or not.
Methods: The second step was related to the pairs trading strategy, introducing the trading rules and determining the thresholds for buying, selling, and exiting the transaction. Any significant deviation from the average in the spread between two securities was a signal to trade and make a profit. We sold or bought the spread when the spread deviated as much as the positive or negative side of the two standard deviations from the average, and when the spread converges within the positive or the negative halfway point of the standard deviation, we exited the trade to make a profit. Of course, as with all trading strategies, the more you use them, the less likely you will make a profit. In this research, the co-integration method was used to select the pair of stocks, and based on the space-state approach and using the Kalman filter algorithm, the dynamic hedge ratio was estimated to provide trading signals. Trading signals were used to develop a pairs trading strategy between 26 companies in the automobile industry on the Tehran Stock Exchange during the period 2016 to 2020.
Results: According to the co-integration results, out of the 26 stocks we selected for analysis, only 16 stocks had a co-integration relationship. According to the Kalman filter method, the CAGR was 0.11 and the Sharp Ratio was 3.06.
Conclusion: The results obtained from the Sharp ratio and Compound annual growth rate (CAGR) showed that the pairs trading strategy in the period under review was profitable in the automobile industry. The results also proved the superiority of the Kalman filter method over the co-integration method for pairs trading.


Main Subjects

Al-Naymat, G., Al-Kasassbeh, M. & Sober, Z. (2018). Pairs trading strategy: a recommendation system. International Journal of Computers and Applications, 42(8), 787-797.
Barahimipour, M. & Davoodi, S.M.R. (2021). The profitability of pairs trading strategy based on linear state-space models and the Kalman filter in Tehran Stock Exchange. Journal of Investment Knowledge, 10(37), 57–75. (in Persian)
Baum, L.E. (1972). An inequality and associated maximization technique in statistical estimation for probabilistic functions of Markov processes. Inequalities, 3(1), 1–8.
Bodie, Z., Kane, A. & Marcus, A. (2018). Investments (vol. 11). London: McGraw-Hill Education-Europe. Hentet September.
Carrasco Blázquez, M. & Prado Román, C. (2018). Pairs trading techniques: An empirical contrast. European Research on Management and Business Economics (ERMBE), 24(3), 160–167.
Chan, E. (2013). Algorithmic trading: winning strategies and their rationale (Vol. 625). John Wiley & Sons.
Chang, V., Man, X., Xu, Q., & Hsu, C. (2020). Pairs trading on different portfolios based on machine learning. Expert Systems, e12649.
Dastoori, M., Fallahpour, S., Tehrani, R. & Mehregan, M. (2018). High frequency pair trading with using Fuzzy SPC. FEJ, 9(37), 23–41.
De Moura, C. E., Pizzinga, A. & Zubelli, J. (2016). A pairs trading strategy based on linear state space models and the Kalman filter. Quantitative Finance, 16(10), 1559–1573.
Ebrahimnejad, A., Barakchian, S., Karimi, A. (2020). Insider Trading and Intraday Stock Price Behavior on the Tehran Stock Exchange. Financial Research Journal, 22(1), 1-26.
(in Persian)
Elliott, R. J., Van Der Hoek, J. & Malcolm, W. P. (2005). Pairs trading. Quantitative Finance, 5(3), 271–276.
Enders, W. (2008). Applied econometric time series. John Wiley & Sons.
Engelberg, J., Gao, P. & Jagannathan, R. (2009). An anatomy of pairs trading: the role of idiosyncratic news, common information and liquidity. Third Singapore International Conference on Finance. Available at SSRN:
Engle, R. F., & Granger, C. W. J. (1987). Co-integration and error correction: representation, estimation, and testing. Econometrica: Journal of the Econometric Society, 251–276.
Fallahpour, S. & Hakimian, H. (2017). Evaluating the Performance of a Pairs Trading System in Tehran Stock Exchange: the Cointegration Approach and Sortino Ratio Analysis. FEJ, 8(30), 1–17. (in Persian)
Fallahpour, S. & Hakimian, H. (2019). Paired Trading Strategy Optimization Using the Reinforcement Learning Method: Intraday Data of Tehran Stock Exchange. Financial Research Journal, 21(1), 19–34.
(in Persian)
Gatev, E., Goetzmann, W. N. & Rouwenhorst, K. G. (2006). Pairs trading: Performance of a relative-value arbitrage rule. The Review of Financial Studies, 19(3), 797–827.
Hamilton, J. D. (1994). Time series analysis. Princeton university press.
Harvey, A. C. (1990). Forecasting, structural time series models and the Kalman filter. Cambridge University Press.
Hekmat, H., Rahmani, A., Mola Nazari, M., Mosavi, M., Ghalibaf Asl, H. (2021). Static & Dynamic Models & Stock Market Efficiency Evaluation of T.S.E. Listed Companies’. Financial Research Journal, 22(4), 476-495. (in Persian)
Jaliliyan, J. & Taherkhani, N. (2019). A Survey on the Pairs Transactions Strategy of in Stock Market of Iran (Case Study of Investment Companies of the Stock Market). Commercial Surveys, 17(96), 23–37. (in Persian)
Johansen, S. & Juselius, K. (1990). Maximum likelihood estimation and inference on cointegration—with appucations to the demand for money. Oxford Bulletin of Economics and Statistics, 52(2), 169–210.
Kamari, F., Saranj, A., Tehrani, R., & Shahbazi, M. (2019). Model design for stock statistical arbitrage using deep neural networks, random forests and gradient-boosted trees. Modern Research in Decision Making, 4(3), 23–45. (in Persian)
Krauss, C. (2017). Statistical arbitrage pairs trading strategies: Review and outlook. Journal of Economic Surveys, 31(2), 513–545.
Kleeman, L. (1996). Understanding and applying Kalman filtering. Proceedings of the Second Workshop on Perceptive Systems, Curtin University of Technology, Perth Western Australia (25-26 January 1996).
Nóbrega, J. P., & Oliveira, A. L. I. (2014). A combination forecasting model using machine learning and kalman filter for statistical arbitrage. 2014 IEEE International Conference on Systems, Man, and Cybernetics (SMC), 1294–1299.
Pole, A. (2011). Statistical arbitrage: algorithmic trading insights and techniques (Vol. 411). John Wiley & Sons.
Rajamani, M. R., & Rawlings, J. B. (2009). Estimation of the disturbance structure from data using semidefinite programming and optimal weighting. Automatica, 45(1), 142–148.
Ramos-Requena, J. P., Trinidad-Segovia, J. E., & Sánchez-Granero, M. Á. (2020). Some Notes on the Formation of a Pair in Pairs Trading. Mathematics, 8(3), 348.
Ramos-Requena, J. P., Trinidad-Segovia, J. E., & Sánchez-Granero, M. A. (2017). Introducing Hurst exponent in pair trading. Physica A: Statistical Mechanics and Its Applications, 488, 39–45.
Smith, R. T., & Xu, X. (2017). A good pair: alternative pairs-trading strategies. Financial Markets and Portfolio Management, 31(1), 1–26.
Tadi, M., Abkar, M., & Motaharinia, V. (2018). Evaluation of Pairs Trading Strategy Using Distance Approach at Tehran Stock Exchange. Journal of Investment Knowledge, 7(26), 99–112. (in Persian)
Talebzadeh, F., Sadeghi, S. (2020). The Effect of Financial Liberalization on Informational Efficiency in Developing Economies: Evidence from State Space and GMM Models. Financial Research Journal, 22(2), 249-265.
Tsay, R. S. (2005). Analysis of financial time series (Vol. 543). John wiley & sons.
Vidyamurthy, G. (2004). Pairs Trading: quantitative methods and analysis (Vol. 217). John Wiley & Sons.
Wells, C. (2013). The Kalman filter in finance (Vol. 32). Springer Science & Business Media.
Wen Yan, W., Chung Wa, K., & YaoBrendan, T. G. (2019). Pairs Trading with Machine Learning. Partial Ful_llment of the Requirements for COMP 4981 in the Department of Computer Science and Engineering, The Hong Kong University of Science and Technology.
Whistler, M. (2004). Trading pairs: capturing profits and hedging risk with statistical arbitrage strategies (Vol. 216). John Wiley & Sons.
Xu, F., & Tan, S. (2020). Dynamic Portfolio Management Based on Pair Trading and Deep Reinforcement Learning. 2020 The 3rd International Conference on Computational Intelligence and Intelligent Systems, 50–55.