Abstract:The stock market is an important part of the financial market, and it is of great importance for stock price prediction. Meanwhile, deep learning has powerful data processing capability to solve the problems caused by the complexity of financial time series. In this regard, this study proposes a hybrid neural network model (ATLG) that combines a self-attention mechanism, a long short-term memory (LSTM) network, and a gated recurrent unit (GRU) for stock price prediction. The experimental results show the followings: (1) The ATLG model has higher accuracy than LSTM, GRU, RNN-LSTM, and RNN-GRU models. (2) The introduction of the self-attention mechanism makes the model more focused on the information of stock characteristics at important time points. (3) Comparison reveals that the two-layer neural network plays a more distinct role. (4) The backtesting with the moving average convergence and divergence (MACD) indicator achieves a 53% return, which is higher than the return of CSI 300 in the same period. The results prove the effectiveness and practicality of the model in stock price prediction.