Abstract
The prediction of the “ups and downs” of stock market prices is one of the important undertakings of the financial market. Since accurate prediction helps foster considerable economic benefits, stock market prediction has attracted significant interest by both investors and researchers. Efforts into building an accurate, stable and effective model to predict stock prices’ movements have been proliferating at a fast pace, to meet such a challenge. Firstly, this paper uses a correlation analysis to analyze the attributes of a stock dataset, processing missing values, determining the data attributes to be retained data, then divide it in a training set and a testing set. Then, the LSTM model is subsequently used to predict the retained attributes after the analysis and retention of prediction results to construct a new testing set. At the same time, the Bo-XGBoost model based on XGBoost is used to train the original training set. It uses Bayesian calculation to optimize the parameters which are proved to be difficult to find the best solution in the XGBoost model. Finally, the LSTM-BO-XGBoost model proposed in this paper is applied to “ES=F”, “YM=F”, “CL=F”, “^TNX”, “^N225”, “NQ=F”, “AAPL”, “GC= F”, “JPY=X” and “SI=F” rates with 10 stocks in the forecast and evaluated by four evaluation indexes: root mean square error (RMSE), average absolute error (MAE), accuracy rate, and F1-score. It is found that the LSTM-BO-XGBoost model proposed in this paper performs better than LSTM in stock price prediction. In order to further evaluate the performance of the algorithm, the LSTM-BO-XGBoost mode is compared with the single LSTM network model and RNN network model, the LSTM-BO-XGBoost hybrid model. The results show that the LSTM-BO-XGBoost mode has high performance, stability and feasibility than the others.
Introduction
Predicting stock market movements is a "grand challenge" due to the non-linear, noisy, and volatile nature of financial data. Traditional statistical models often struggle with these complexities, while single deep learning architectures like Recurrent Neural Networks (RNNs) or Long Short-Term Memory (LSTM) networks may fail to capture high-dimensional tabular interactions or converge to sub-optimal solutions. This paper addresses two primary hurdles: effectively combining temporal trends with gradient-boosted tree predictive power and automating the sensitive hyperparameter tuning process of XGBoost.
Methodology
The proposed LSTM-BO-XGBoost model utilizes a multi-stage pipeline designed to move beyond simple "black box" prediction.
- Correlation Analysis and Preprocessing: The dataset is first cleaned of missing values. A correlation analysis is performed to filter out low-impact features. For instance, attributes like "Volume" and specific time components (Year, Weekday) were found to have low correlation with price direction and were removed to reduce noise.
- LSTM as a Feature Forecaster: Rather than predicting the final price directly, an LSTM network is employed to forecast the future values of five key attributes: Open, High, Low, Close, and Adjusted Close. This step creates a "reconstructed" dataset that serves as input for the final classification.
- BO-XGBoost for Classification: The final "up or down" prediction is handled by an XGBoost model. To optimize performance, Bayesian Optimization (BO) is integrated to intelligently search for the best hyperparameters (e.g.,
n_estimators,max_depth,reg_alpha), significantly improving efficiency over manual or random search methods.
Datasets and Experimental Setup
The model was evaluated using historical data from January 2002 to August 2020, sourced from Yahoo Finance. To ensure robustness, the authors selected a diverse set of 10 stocks and indices:
- Indices/Futures: ES=F (S&P 500), YM=F (Dow Jones), NQ=F (Nasdaq 100), ^N225 (Nikkei 225), ^TNX (10-Year Treasury Note).
- Equities/Commodities: AAPL (Apple), GC=F (Gold), SI=F (Silver).
- Forex: JPY=X (USD/JPY).
The data was split into an 80% training set and a 20% testing set. The high volatility and non-stationary nature of these time series are evident in the raw data plots.
Results and Discussion
The hybrid LSTM-BO-XGBoost model was compared against standalone LSTM and RNN architectures. Key findings include:
- Performance Gains: For the ES=F (S&P 500 Futures) dataset, the hybrid model achieved an accuracy of 0.60 and an F1-score of 0.75, compared to 0.52 and 0.55 respectively for a standard LSTM.
- Error Reduction: Across all 10 datasets, the hybrid model consistently showed lower Root Mean Square Error (RMSE) and Mean Absolute Error (MAE), indicating a more precise fit to actual market movements.
- Stability: The integration of Bayesian Optimization provided higher stability and better generalization, proving that automated tuning is essential for complex models like XGBoost in financial contexts.
The core advantage of this approach lies in the "division of labor": LSTMs handle temporal feature trends, while XGBoost excels at snapshot classification based on those predicted features.
Conclusion
The LSTM-BO-XGBoost model demonstrates superior performance, stability, and feasibility for predicting stock price fluctuations. While the model currently focuses on binary classification (ups and downs), future work could extend this to predicting the magnitude of price changes. Additionally, incorporating external factors such as news sentiment analysis could further enhance predictive accuracy in the face of market "noise."
Summary updated