Robust Portfolio Optimization using LSTM-based Stock and Cryptocurrency Price Prediction: An Application of Algorithmic Trading Strategies

Document Type : Original Article

Authors

1 MSc Student in Industrial Engineering, Faculty of Industrial Engineering, Iran University of Science and Technology, Tehran, Iran

2 School of Industrial Engineering, Iran University of Science and Technology, Tehran, Iran

3 IUST

10.22067/ijaaf.2025.46039.1466

Abstract

Algorithmic trading (AT) has become widely used recently because of its high speed and accuracy in implementing diverse and complex strategies. Using algorithms also allows traders to execute their trading strategies in a high volume and numerous transactions without involving human emotions. While AT has many advantages, it also carries some risks due to the uncertain stock market conditions and the impact of news and political, social, and other events. Therefore, forming a stock portfolio and stabilizing against uncertainties, in conjunction with accurate market predictions, can significantly reduce risk.in this paper, For the first time, we developed a robust portfolio optimization model based on LSTM prediction using the AT strategies based on short-term moving average techniques. First, we implement the strategies derived from the VLMA, FLMA, EMA, and SMA algorithms based on the LSTM's predicted price. Secondly, we develop a robust portfolio optimization model using the abovementioned algorithms. The results show that in both stock and crypto portfolios, moving average strategies will perform better than the benchmark strategy (Buy-and-hold). Also, when the model parameters are deterministic, the robust portfolio constructed stocks and crypto will perform better than Buy-and-hold for all algorithms. However, when the variance from certain models increases, VLMA and FLMA (15-day holding) for stocks and FLMA (30-day holding) for the crypto will not be a suitable investment option. Additionally, portfolios constructed using all AT strategies and all assets outperform the benchmark portfolio in certain and non-certain markets.

Keywords

Main Subjects


  1. Ahmad, I., Ahmad, M. O., Alqarni, M. A., Almazroi, A. A. and Khalil, M. I. K. (2021). Using algorithmic trading to analyze short term profitability of Bitcoin. PeerJ Computer Science, 7(1), A. e337. https://doi.org/10.7717/peerj-cs.337
  2. Ariyo, A. A., Adewumi, A. O. and Ayo, C. K. (2014). Stock price prediction using the ARIMA model. In 2014 UKSim-AMSS 16th international conference on computer modelling and simulation, (pp. 106-112). IEEE. Cambridge, UK
  3. Aycel, Ü. and Santur, Y. (2022). A new moving average approach to predict the direction of stock movements in algorithmic trading. Journal of New Results in Science, 11(1), pp. 13-25. https://doi.org/10.54187/jnrs.979836
  4. Bertsimas, D. and Sim, M. (2004). The price of robustness. Operations Research, 52(1), pp. 35-53. https://doi.org/10.1287/opre.1030.0065
  5. Brock, W., Lakonishok, J. and LeBaron, B. (1992). Simple technical trading rules and the stochastic properties of stock returns. The Journal of Finance, 47(5), pp. 1731-1764. https://doi.org/10.1111/j.1540-6261.1992.tb04681.x
  6. Chaboud, A. P., Chiquoine, B., Hjalmarsson, E. and Vega, C. (2014). Rise of the machines: Algorithmic trading in the foreign exchange market. The Journal of Finance, 69(5), pp. 2045-2084. https://doi.org/10.1111/jofi.12186
  7. Chang, Y. H., Jong, C. C. and Wang, S. C. (2017). Size, trading volume, and the profitability of technical trading. International Journal of Managerial Finance, 13(4), pp. 475-494. https://doi.org/10.1108/IJMF-09-2016-0179
  8. Chen, W., Zhang, H., Mehlawat, M. K. and Jia, L. (2021). Mean–variance portfolio optimization using machine learning-based stock price prediction. Applied Soft Computing, 100(1), A. 106943. https://doi.org/10.1016/j.asoc.2020.106943
  9. Cipiloglu Yildiz, Z. and Yildiz, S. B. (2022). A portfolio construction framework using LSTM‐based stock markets forecasting. International Journal of Finance & Economics, 27(2), pp. 2356-2366. https://doi.org/10.1002/ijfe.2277
  10. Dai, Z. and Zhu, H. (2020). Stock return predictability from a mixed model perspective. Pacific-Basin Finance Journal, 60, A. 101267. https://doi.org/10.1016/j.pacfin.2020.101267
  11. Eskorouchi, A., Ghanbari, H., & Mohammadi, E. (2024). Exploring the evolution of robust portfolio optimization: a scientometric analysis. Iranian Journal of Accounting, Auditing and Finance, 8(3), pp. 75-92. https://doi.org/22067/ijaaf.2024.44518.1402
  12. Eskorouchi, A., Mohammadi, E. and Sadjadi, S. J. (2022). Robust portfolio optimization based on evidence theory. Scientia Iranica. Articles in Press (In Persian). https://doi.org/10.24200/sci.2022.59575.6330
  13. Ferdiansyah, F., Othman, S. H., Radzi, R. Z. R. M., Stiawan, D., Sazaki, Y. and Ependi, U. (2019). A lstm-method for bitcoin price prediction: A case study yahoo finance stock market. In 2019 international conference on electrical engineering and computer science (ICECOS) (pp. 206-210). IEEE. Cambridge, UK
  14. Frattini, A., Bianchini, I., Garzonio, A. and Mercuri, L. (2022). Financial technical indicator and algorithmic trading strategy based on machine learning and alternative data. Risks, 10(12), p. 225. https://www.mdpi.com/2227-9091/10/12/225#
  15. Fu, A. and Wang, B. (2020). Portfolio optimization based on LSTM neural network prediction. In 2020 IEEE International Conference on Networking, Sensing and Control (ICNSC) (pp. 1-5). IEEE. Cambridge, UK
  16. Garcia, D. and Schweitzer, F. (2015). Social signals and algorithmic trading of Bitcoin. Royal Society open science, 2(9), A. 150288. https://doi.org/10.1098/rsos.150288
  17. Goldfarb, D. and Iyengar, G. (2003). Robust portfolio selection problems. Mathematics of Operations Research, 28(1), pp. 1-38. https://doi.org/10.1287/moor.28.1.1.14260
  18. Graves, A. and Schmidhuber, J. (2005). Framewise phoneme classification with bidirectional LSTM and other neural network architectures. Neural Networks, 18(5-6), pp. 602-610. https://doi.org/10.1016/j.neunet.2005.06.042
  19. Hendershott, T., Jones, C. M. and Menkveld, A. J. (2011). Does algorithmic trading improve liquidity? The Journal of Finance, 66(1), pp. 1-33. https://doi.org/10.1111/j.1540-6261.2010.01624.x
  20. Imajo, K., Minami, K., Ito, K. and Nakagawa, K. (2021). Deep portfolio optimization via distributional prediction of residual factors. In Proceedings of the AAAI Conference on Artificial Intelligence, 35(1), pp. 213-222. https://doi.org/10.1609/aaai.v35i1.16095
  21. Iqbal, J., Ahmad, I. and Shah, A. (2019). Competitive algorithms for online conversion problem with interrelated prices. International Journal of Advanced Computer Science and Applications, 10(6), pp. 1-9.
  22. Kalariya, V., Parmar, P., Jay, P., Tanwar, S., Raboaca, M. S., Alqahtani, F., ... and Neagu, B. C. (2022). Stochastic neural networks-based algorithmic trading for the cryptocurrency market. Mathematics, 10(9), A. 1456. https://doi.org/10.3390/math10091456
  23. Kim, J. H., Kim, W. C. and Fabozzi, F. J. (2018). Recent advancements in robust optimization for investment management. Annals of Operations Research, 266, pp. 183-198. https://doi.org/10.1007/s10479-017-2573-5
  24. Lassance, N. (2022). Reconciling mean-variance portfolio theory with non-Gaussian returns. European Journal of Operational Research, 297(2), pp. 729-740. https://doi.org/10.1016/j.ejor.2021.06.016
  25. Lee, J. W. (2001). Stock price prediction using reinforcement learning. In ISIE 2001. 2001 IEEE International Symposium on Industrial Electronics Proceedings (Cat. No. 01TH8570), 1, pp. 690-695. IEEE. Cambridge, UK
  26. Lei, Y., Peng, Q. and Shen, Y. (2020). Deep learning for algorithmic trading: enhancing MACD strategy. In Proceedings of the 2020 6th International Conference on Computing and Artificial Intelligence, University of Tsukuba, Tsukuba, Japan (pp. 51-57). https://doi.org/10.1145/3404555.3404604
  27. Lim, A. E. and Zhou, X. Y. (2002). Mean-variance portfolio selection with random parameters in a complete market. Mathematics of Operations Research, 27(1), pp. 101-120. https://doi.org/10.1287/moor.27.1.101.337
  28. Lin, Q., Luo, Y. and Sun, X. (2022). Robust investment strategies with two risky assets. Journal of Economic Dynamics and Control, 134, A. 104275. https://doi.org/10.1016/j.jedc.2021.104275
  29. Low, R. K. Y., Faff, R. and Aas, K. (2016). Enhancing mean–variance portfolio selection by modeling distributional asymmetries. Journal of Economics and Business, 85, pp. 49-72. https://doi.org/10.1016/j.jeconbus.2016.01.003
  30. Ma, Y., Han, R. and Wang, W. (2021). Portfolio optimization with return prediction using deep learning and machine learning. Expert Systems with Applications, 165, A. 113973. https://doi.org/10.1016/j.eswa.2020.113973
  31. Markowitz, H. (1952). The utility of wealth. Journal of political Economy, 60(2), pp. 151-158. https://doi.org/10.1086/257177
  32. Ming-Ming, L. and Siok-Hwa, L. (2006). The profitability of the simple moving averages and trading range breakout in the Asian stock markets. Journal of Asian Economics, 17(1), pp. 144-170. https://doi.org/10.1016/j.asieco.2005.12.001
  33. Mohr, E., Ahmad, I. and Schmidt, G. (2014). Online algorithms for conversion problems: a survey. Surveys in Operations Research and Management Science, 19(2), pp. 87-104. https://doi.org/10.1016/j.sorms.2014.08.001
  34. Moldovan, D., Moca, M. and Nitchi, S. (2011). A stock trading algorithm model proposal, based on technical indicators signals. Informatica Economica, 15(1), p. 183.
  35. Mondal, P., Shit, L. and Goswami, S. (2014). Study of effectiveness of time series modeling (ARIMA) in forecasting stock prices. International Journal of Computer Science, Engineering and Applications, 4(2), p. 13.
  36. Obthong, M., Tantisantiwong, N., Jeamwatthanachai, W. and Wills, G. (2020). A survey on machine learning for stock price prediction: Algorithms and techniques. 2nd International Conference on Finance, Economics, Management and IT Business, Vienna House Diplomat Prague, Prague, Czech Republic, 63-71. http://dx.doi.org/10.5220/0009340700630071
  37. Raffinetti, E. (2023). A rank graduation accuracy measure to mitigate artificial intelligence risks. Quality & Quantity, 57(Suppl 2), 131-150. https://doi.org/10.1007/s11135-023-01613-y
  38. Rather, A. M. (2021). Lstm-based deep learning model for stock prediction and predictive optimization model. EURO Journal on Decision Processes, 9(1), A. 100001. https://doi.org/10.1016/j.ejdp.2021.100001
  39. Salkar, T., Shinde, A., Tamhankar, N. and Bhagat, N. (2021). Algorithmic trading using technical indicators. In 2021 International Conference on Communication information and Computing Technology (ICCICT) (pp. 1-6). IEEE. Cambridge, UK
  40. Schmidt, G., Mohr, E. and Kersch, M. (2010). Experimental analysis of an online trading algorithm. Electronic Notes in Discrete Mathematics, 36, pp. 519-526. https://doi.org/10.1016/j.endm.2010.05.066
  41. Scholtus, M., Van Dijk, D. and Frijns, B. (2014). Speed, algorithmic trading, and market quality around macroeconomic news announcements. Journal of Banking & Finance, 38, pp. 89-105. https://doi.org/10.1016/j.jbankfin.2013.09.016
  42. Schöneburg, E. (1990). Stock price prediction using neural networks: A project report. Neurocomputing, 2(1), pp. 17-27. https://doi.org/10.1016/0925-2312(90)90013-H
  43. Sen, J., Mondal, S. and Nath, G. (2021). Robust portfolio design and stock price prediction using an optimized LSTM model. In 2021 IEEE 18th India Council International Conference (INDICON) (pp. 1-6). IEEE. Cambridge, UK
  44. Shahvaroughi Farahani, M. (2021). Prediction of interest rate using artificial neural network and novel meta-heuristic algorithms. Iranian Journal of Accounting, Auditing and Finance, 5(1), pp. 1-30 (In Persian). https://doi.org/10.22067/ijaaf.2021.67957.1017
  45. Shavandi, A. and Khedmati, M. (2022). A multi-agent deep reinforcement learning framework for algorithmic trading in financial markets. Expert Systems with Applications, 208, A. 118124. https://doi.org/10.1016/j.eswa.2022.118124
  46. Siami-Namini, S., Tavakoli, N. and Namin, A. S. (2019). The performance of LSTM and BiLSTM in forecasting time series. In 2019 IEEE International Conference on Big Data (Big Data) (pp. 3285-3292). IEEE. New York
  47. Soyster, A. L. (1973). Convex programming with set-inclusive constraints and applications to inexact linear programming. Operations Research, 21(5), pp. 1154-1157. https://doi.org/10.1287/opre.21.5.1154
  48. Spearman, C. (1961). The proof and measurement of association between two things. Appleton-Century-Crofts. (pp. 45–58). https://psycnet.apa.org/doi/10.1037/11491-005
  49. Ta, V. D., Liu, C. M. and Tadesse, D. A. (2020). Portfolio optimization-based stock prediction using long-short term memory network in quantitative trading. Applied Sciences, 10(2), p. 437. https://doi.org/10.3390/app10020437
  50. Vo, A. and Yost-Bremm, C. (2020). A high-frequency algorithmic trading strategy for cryptocurrency. Journal of Computer Information Systems, 60(6), pp. 555-568. https://doi.org/10.1080/08874417.2018.1552090
  51. Weller, B. M. (2018). Does algorithmic trading reduce information acquisition? The Review of Financial Studies, 31(6), 2184-2226. https://doi.org/10.1093/rfs/hhx137
  52. Yu, J. R., Chiou, W. J. P., Lee, W. Y. and Lin, S. J. (2020). Portfolio models with return forecasting and transaction costs. International Review of Economics & Finance, 66, pp. 118-130. https://doi.org/10.1016/j.iref.2019.11.002
  53. Zhu, H., Jiang, Z. Q., Li, S. P. and Zhou, W. X. (2015). Profitability of simple technical trading rules of Chinese stock exchange indexes. Physica A: Statistical Mechanics and its Applications, 439, pp. 75-84. https://doi.org/10.1016/j.physa.2015.07.032 
CAPTCHA Image