Stock price prediction in Chinese stock markets based on CNN-GRU-attention model

Stock price prediction is a hot topic and has attracted the sufficient attention of both regulatory authorities and financial institutions. Because the fluctuation of stock prices is the result of many different factors, it is not easy to make stock price prediction. Traditional prediction solutions are mainly using simple linear models based on statistical and econometric models, these solutions are difficult to support nonstationary time series data. With the development of deep learning, some newly models can not only support non-linear data, but also retain useful information for better forecasting the stock prices. This paper aims to construct a CNN-GRU-Attention based model for price prediction in Chinese stock markets. First, the convolutional and pooling layers of CNN are used to extract features of factor correlation information from the input data; then, the output of feature matrix is used as input for the GRU model to forecast correlation; finally, the Attention mechanism is used to focus on the important characteristics of stock prices and optimize model structure. We collect multi-dimensional stock data of the China SSE 50 index from 2011 to 2021 as our dataset and conduct a set of experiments to compare the performance, which measured in terms of their Mean Absolute Percentage Error (MAPE), Root Mean Squared Error (RMSE) and R squared (R²) score. The proposed model is superior to other models: MAPE decreased by 11.23%, RMSE decreased by 5.71% and R²score improved by 0.41%, which shows that the CNN-GRU-Attention model outperforms state-of-the-art approaches in forecasting stock price.