Forecasting International Stock Market Trends: XGBoost, LSTM, LSTM-XGBoost, and Backtesting XGBoost Models
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.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.
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).