Forecasting International Stock Market Trends: XGBoost, LSTM, LSTM-XGBoost, and Backtesting XGBoost Models

  • HASSAN OUKHOUYA Laboratory LMSA, Department of Mathematics, Faculty of Sciences, Mohammed V University of Rabat
  • HAMZA KADIRI Laboratory MAEGE, Department of SMAEG, FSJES Ain Sebaa, Hassan II University of Casablanca, Morocco https://orcid.org/0009-0000-2278-4190
  • KHALID EL HIMDI Laboratory LMSA, Department of Mathematics, Faculty of Sciences, Mohammed V University of Rabat, Morocco
  • RABY GUERBAZ Laboratory MAEGE, Department of SMAEG, FSJES Ain Sebaa, Hassan II University of Casablanca, Morocco
Keywords: Time series, Modeling, Forecasting, Stock market, LSTM, XGBoost, Hybrid model, Backtesting, Grid Search

Abstract

Forecasting time series is crucial for financial research and decision-making in business. The nonlinearity of stock market prices profoundly impacts global economic and financial sectors. This study focuses on modeling and forecasting the daily prices of key stock indices - MASI, CAC 40, DAX, FTSE 250, NASDAQ, and HKEX, representing the Moroccan, French, German, British, US, and Hong Kong markets, respectively. We compare the performance of machine learning models, including Long Short-Term Memory (LSTM), eXtreme Gradient Boosting (XGBoost), and the hybrid LSTM-XGBoost, and utilize the skforecast library for backtesting. Results show that the hybrid LSTM-XGBoost model, optimized using Grid Search (GS), outperforms other models, achieving high accuracy in forecasting daily prices. This contribution offers financial analysts and investors valuable insights, facilitating informed decision-making through precise forecasts of international stock prices.  

Author Biographies

HAMZA KADIRI, Laboratory MAEGE, Department of SMAEG, FSJES Ain Sebaa, Hassan II University of Casablanca, Morocco
Master's candidate specializing in Actuarial Science and Finance at the University of Hassan II of Casablanca. My expertise lies in statistical analysis, Big Data, Python, Machine Learning, Deep Learning, and Time Series Forecasting. My committed to advancing research and making significant contributions in these fields.    
KHALID EL HIMDI, Laboratory LMSA, Department of Mathematics, Faculty of Sciences, Mohammed V University of Rabat, Morocco
   
RABY GUERBAZ, Laboratory MAEGE, Department of SMAEG, FSJES Ain Sebaa, Hassan II University of Casablanca, Morocco
   

References

K. K. Yun, S. W. Yoon, and D. Won, “Prediction of stock price direction using a hybrid ga-xgboost algorithm with a three-stage feature engineering process,” Expert Systems with Applications, vol. 186, p. 115 716, 2021.

E. Guresen, G. Kayakutlu, and T. U. Daim, “Using artificial neural network models in stock market index prediction,” Expert systems with Applications, vol. 38, no. 8, pp. 10 389–10 397, 2011.

M.-L. Thormann, J. Farchmin, C. Weisser, R.-M. Kruse, B. S¨afken, and A. Silbersdorff, “Stock price

predictions with lstm neural networks and twitter sentiment,” Statistics, Optimization & Information Computing, vol. 9, no. 2, pp. 268–287, 2021.

Y. Jouilil et al., “Comparing the accuracy of classical and machine learning methods in time series

forecasting: A case study of usa inflation,” Statistics, Optimization & Information Computing, vol. 11, no. 4, pp. 1041–1050, 2023.

A. A. Ariyo, A. O. Adewumi, and C. K. Ayo, “Stock price prediction using the arima model,” in 2014 UKSim-AMSS 16th International Conference on Computer Modelling and Simulation, 2014, pp. 106–112.

P. C. S. Bezerra and P. H. M. Albuquerque, “Volatility forecasting via svr–garch with mixture of gaussian kernels,” Computational Management Science, vol. 14, pp. 179–196, 2017.

D. Shah, H. Isah, and F. Zulkernine, “Stock market analysis: A review and taxonomy of prediction techniques,” International Journal of Financial Studies, vol. 7, no. 2, 2019.

G. Ding and L. Qin, “Study on the prediction of stock price based on the associated network model of lstm,” International Journal of Machine Learning and Cybernetics, vol. 11, Jun. 2020.

J. Shen and M. O. Shafiq, “Short-term stock market price trend prediction using a comprehensive deep learning system,” Journal of big Data, vol. 7, no. 1, pp. 1–33, 2020.

P. H. Vuong, T. T. Dat, T. K. Mai, P. H. Uyen, et al., “Stock-price forecasting based on xgboost and lstm.,” Computer Systems Science & Engineering, vol. 40, no. 1, 2022.

H. Oukhouya and K. El Himdi, “Comparing machine learning methods—svr, xgboost, lstm, and mlp—for

forecasting the moroccan stock market,” in Computer Sciences & Mathematics Forum, MDPI, vol. 7, 2023, p. 39.

H. Ettayyebi and K. El Himdi, “Artificial neural network for forecasting one day ahead of global solar irradiance,” Smart Application and Data Analysis for Smart Cities (SADASC’18), 2018.

L. Semmelmann, S. Henni, and C. Weinhardt, “Load forecasting for energy communities: A novel lstm-xgboost hybrid model based on smart meter data,” Energy Informatics, vol. 5, no. 1, pp. 1–21, 2022.

S. Gutmann, C. Maget, M. Spangler, and K. Bogenberger, “Truck parking occupancy prediction: Xgboost-lstm model fusion,” Frontiers in Future Transportation, vol. 2, p. 693 708, 2021.

J. Amat Rodrigo and J. Escobar Ortiz, skforecast, version 0.9.0, Jul. 2023.

H. Chung and K.-s. Shin, “Genetic algorithm-optimized multi-channel convolutional neural network for stock market prediction,” Neural Computing and Applications, vol. 32, pp. 7897–7914, 2020.

P. Devan and N. Khare, “An efficient xgboost–dnn-based classification model for network intrusion detection system,” Neural Computing and Applications, vol. 32, pp. 12 499–12 514, 2020.

S. Li and X. Zhang, “Research on orthopedic auxiliary classification and prediction model based on xgboost algorithm,” Neural Computing and Applications, vol. 32, pp. 1971–1979, 2020.

T. Chen and C. Guestrin, “Xgboost: A scalable tree boosting system,” in Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, 2016, pp. 785–794.

R. Pascanu, T. Mikolov, and Y. Bengio, “On the difficulty of training recurrent neural networks,” in International conference on machine learning, Pmlr, 2013, pp. 1310–1318.

J. Schmidhuber, S. Hochreiter, et al., “Long short-term memory,” Neural Comput, vol. 9, no. 8, pp. 1735–1780, 1997.

Y. Wang and X. S. Ni, “A xgboost risk model via feature selection and bayesian hyper-parameter optimization,” arXiv preprint arXiv:1901.08433, 2019.

A. G´eron, Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow. ” O’Reilly Media, Inc.”, 2022.

M. Abadi, A. Agarwal, P. Barham, et al., “Tensorflow: Large-scale machine learning on heterogeneous distributed systems,” arXiv preprint arXiv:1603.04467, 2016.

Anaconda software distribution, version Vers. 2-2.4.1, 2020. [Online]. Available: https://docs.anaconda.com/.

S. Selvin, R. Vinayakumar, E. Gopalakrishnan, V. K. Menon, and K. Soman, “Stock price prediction using lstm, rnn and cnn-sliding window model,” in 2017 international conference on advances in computing, communications and informatics (icacci), IEEE, 2017, pp. 1643–1647.

A. Dezhkam and M. T. Manzuri, “Forecasting stock market for an efficient portfolio by combining xgboost and hilbert–huang transform,” Engineering Applications of Artificial Intelligence, vol. 118, p. 105 626, 2023.

S. Deng, X. Huang, Y. Zhu, Z. Su, Z. Fu, and T. Shimada, “Stock index direction forecasting using an explainable extreme gradient boosting and investor sentiments,” The North American Journal of Economics and Finance, vol. 64, p. 101 848, 2023.

Published
2023-11-03
How to Cite
OUKHOUYA, H., KADIRI, H., EL HIMDI, K., & GUERBAZ, R. (2023). Forecasting International Stock Market Trends: XGBoost, LSTM, LSTM-XGBoost, and Backtesting XGBoost Models. Statistics, Optimization & Information Computing, 12(1), 200-209. https://doi.org/10.19139/soic-2310-5070-1822
Section
Research Articles