Stock forecasting has always been a hot and difficult topic in the research of domestic and foreign scholars,and stock research also has important practical and theoretical significance.Stock data is time-dependent,while neural network has achieved a good performance in dealing with time series.Among them,the long-term and short-term memory neural network is very suitable for dealing with such time-series data with long-term dependence.But LSTM has less practice in stock price prediction.This paper mainly studies the LSTM neural network for stock price prediction,and the research contents mainly include:First,in the selection of research objects,considering that when a single stock is studied,it is likely that there will be market makers controlling the market or the main players making the market,so the stock index is selected as the research object.As the stock markets of developing countries represented by China’s stock market are vulnerable to policy influences,in this study,the U.S.stock market is mainly taken as the research object,and the S&P 500 index,which is representative of the U.S.stock market,is mainly selected as the research object.In order to verify the feasibility of the model,we will compare the prediction results of the model in different stock markets,and when satisfactory results are reached,we will use the model to verify the China Securities 500 index,which is representative of the Chinese stock market.In the selection of characteristic data,in order to consider as many factors as possible that affect the stock price,and in combination with the indexes selected in past studies and the influencing factors of stock price,we have chosen 25 characteristic indexes for predicting stock price from two aspects of basic transaction data OHLC and technical indexes.Because each index has different dimensions,in data preprocessing,the input data is normalized to eliminate the influence of different dimensions.Second,because the input data of complex multidimensional and the relationships between dimensions,this paper chose the principal component analysis of the feature extraction method of input data for the feature extraction,mainly by observing the principal component analysis of variance of ratios to determine how much is the extraction of information,so as to determine the dimensions of extraction,we chose the different dimensions of model building,by comparing the choice prediction error minimum number of dimensions.Thirdly,in terms of the parameter setting of the LSTM model,we compared the number of hidden layers,hidden layer neurons,dropout value,optimization function selection and other aspects to discuss the stock prediction effect of different model structures and parameter setting.Finally,the structure of LSTM neural network prediction model in this experiment is determined.Fourth,the prediction results of the LSTM neural network model determined in this experiment were compared with the prediction results of the traditional BP neural network and RNN neural network,and the accuracy of the LSTM model was verified by comparing the two aspects of graph fitting and error analysis.Fifth,in order to further verify the feasibility of the model,we chose to substitute the representative data of the China Securities Exchange 500 Index into the model for prediction,and compared the Standard & Poor’s 500 Index with the China Securities Exchange 500 Index.We found that the error of the China Securities Exchange 500 Index is slightly larger,which shows that the difference in the stock market will affect the prediction accuracy,but the error of both is not too large.Although the LSTM-based prediction model cannot completely fit the two stock prices,the stock prediction value basically fluctuates around the real value,and the change trend of the prediction value is basically consistent with the real value,which shows the feasibility of the model. |