| With the rapid development of deep learning theory and technology,deep learning has been applied more and more widely in the financial field.Especially in the field of algorithmic trading,deep learning technology shows a good application prospect in stock prediction,quantitative trading,risk management and other aspects.In Deep Learning technology,Long Short-Term Memory(LSTM)has been widely used for its advantages in dealing with long time series problems.Therefore,this paper intends to develop a LSTM model based on particle swarm optimization attention mechanism to predict stock prices and construct algorithmic trading strategies.First of all,this paper takes the stocks in the banking sector as the research object and selects 9 bank stocks in the A-share market.Supposing that the historical information of stocks has an impact on the prediction of stocks in real markets,this paper first studies the prediction of stock prices by LSTM model with different time steps,divides the data into data sets with time steps of 3,5,10,20 and 50,and then conducts model training It is found that 10 is the optimal time step for predicting stock prices in the banking sector.Then,the paper introduces the attention mechanism,using the attention mechanism to selectively pay attention to some important information of the stock data,and builds the LSTMATT model.Then the particle swarm optimization algorithm is implemented to optimize the number of neurons in the LSTM model,and the PSO-LSTM model was constructed.Then the attention mechanism and particle swarm optimization algorithm are combined to construct the PSO-ATT-LSTM model.Comparing the evaluation indexes of LSTM model,LSTM-ATT model,PSO-LSTM model and PSO-ATT-LSTM model,we determine the PSO-ATT-LSTM model to be the optimal model for stock price prediction in the banking sector.Finally,we construct the trading strategy,and the trading strategy after stock price prediction by using the trend tracking strategy and carry out trading simulation by setting trading rules.The results show that investors can obtain higher returns by using the trading strategy of the PSO-ATT-LSTM model constructed in this paper. |