Abstract:Time series analysis methods and neural networks have certain limitations for stock price prediction.Therefore, Attention mechanism was introduced into the LSTM model to predict the stock price. The related data of Shanghai Stock Industry Index and Shanghai Environmental Protection Index from January 2, 2014 to September 22, 2020 was collected as samples, and based on these samples, the LSTM combined with Attention mechanism was used to focus on important stock price characteristic information and predict the highest stock price of the second day. The empirical results found that compared with MLP, RNN and LSTM models, the RMSE value of the LSTM model combined with the Attention mechanism was lower than the benchmark model by about 3%45% on average. The four models all had higher prediction accuracy for environmental protection companies than polluting companies. Subsequently, the air quality index, temperature and humidity were included into the characteristics to improve the quality of the data that reflects the characteristics of polluting companies and environmental protection companies. The empirical results found that after adding new features, the RMSE values of the four models all dropped by about 1% when predicting the fluctuating trend of the Shanghai Industrial Index and the Shanghai Environmental Protection Index.