Abstract
The financial market has randomness, and the prediction of the financial market is an important task in the financial market. In traditional financial market prediction models, the prediction results are often unsatisfactory. So it needs to introduce new models for financial analysis. To solve this problem, this paper analyzed a financial market trend prediction model based on LSTM (Long Short-Term Memory) NN (Neural Network) algorithm, and conducted an empirical analysis on the Shanghai stock index dataset. This paper first introduced the LSTM NN algorithm, and then divided it into training set, test set and comparison set according to the data characteristics. At last, this paper used the data preprocessing method to verify the LSTM NN algorithm. The experimental results showed that the LSTM NN algorithm analyzed in this paper can effectively improve the generalization ability of financial market trend prediction models while ensuring the prediction accuracy. Through experimental analysis, this paper found that the average accuracy rate of using LSTM NN algorithm was 2.25% higher than that of using traditional NN algorithm. This research is primarily aimed at developing effective methods for predicting stock market trends in the continuously evolving Chinese securities market. The core objective is to empower investors with precise guidance by enabling them to make well-informed investment decisions. Achieving accurate predictions holds the potential to significantly impact economic operations in a positive way. Therefore, this research direction is of paramount importance, offering substantial value both in academic exploration and practical application.
Introduction
The stock market plays a crucial role in the development of the financial industry. It is influenced by various factors such as the political and economic environment, international financial environment, and company operating conditions. In the stock market, it is feasible to use the nonlinear mapping characteristics of neural networks to construct a prediction model for the stock market. Simply applying statistical theory cannot achieve ideal forecasting results. Basic analysis method and technical analysis method are two commonly used tools in securities trading. Basic analysis method is an analytical method that links macroeconomic and corporate profit situations with stock market trends. Technically, analysis and prediction were only conducted based on relevant indicators from the early stage. The technical analysis method has its shortcomings, and the stock market cannot be influenced by unexpected factors.
In the past decade, some intelligent data mining technologies, such as NN, have received increasing attention. In today’s rapidly developing economy, information forecasting and analysis in the securities market has become a crucial link. Anand, C found that nonlinear models such as NN and linear regression synthesized by autoregression can be used for predicting stock prices. Prediction methods include convolutional NN, LSTM, recurrent NN, multilayer perceptron, support vector machine and other methods [1]. Stock market data refers to a temporal data of stock price fluctuations in the stock market. The trend of the stock market is used to estimate the future value of a company’s stock, thereby improving investors’ returns. How to accurately predict the stock market has always been a challenge. NN technology utilizes specific stock data collected from multiple channels to predict the overall trend of the stock market. This new technology can generate a signal that accurately predicts stock market trends, allowing users to decide whether a stock is being bought or sold. Ananthi, M. used machine learning methods to study the prediction accuracy of the stock market and improved the prediction accuracy to 85% [2]. Leippold, Markus utilized various NN methods to establish and studied a complete set of return models, thereby enriching and developing empirical valuation theories in the Chinese stock market. Compared to previous surveys on the US (the United States) stock market, capital flow has become the main predictive indicator, which allows people to better understand the role of transaction costs in the stock market. The majority of individual investors have a positive impact on short-term market expectations, especially for small cap stocks. Another difference between the Chinese stock market and the US stock market is that the stock market is relatively large, and the stock prices of state-owned enterprises are also high, with good long-term performance. After deducting transaction costs, the external performance of the sample still has significant economic significance [3]. Although the NN methods can be applied to the financial market, they cannot solve the problem of financial time series prediction.
With the continuous expansion of the financial market, many scholars have conducted research on the stock market in the financial market. Hong, Hui believed that the impact of the epidemic on the stock market is a very valuable research topic, and the impact of the epidemic on the stock market can demonstrate predictability and stock price volatility [4]. Corporate bankruptcy remains a serious financial problem, which not only affects businesses but also financial institutions. Veganzones, David mainly studied the design of the basic elements of the stock market failure prediction model for companies (definition of failure, sampling methods, prediction methods, variables and evaluation indicators, and performance) [5]. Apergis, Nicholas analyzed the changes in stock market returns and volatility in China under multiple factors of impact. Statistically, multiple factors have a significant positive effect on the volatility of securities investment portfolio returns. Overall, new evidence suggests that factors such as inflation have a significant impact on stock market returns and their volatility. The research findings are of great significance for understanding how inflation affects the Chinese stock market [6]. Although the research has carried out research on the financial market, it has not applied the LSTM NN algorithm to it.
In recent years, due to the continuous development of the stock market, many experts and scholars have been continuously analyzing various methods for predicting the stock market. Some scholars believe that the stock market is a time series with noise. Using time series analysis methods, a high-precision time series model is constructed by analyzing the daily closing price and real-time data. However, to build a systematic and comprehensive forecasting system for stock prices, too many factors need to be considered and the calculation steps are too many. On this basis, this paper analyzes a method of forecasting the trend of the stock market using LSTM NN, and forecasts the trend of the stock market. The experiment shows that LSTM plays a greater role in the financial market. At the same time, it can also be applied in financial analysis, function approximation, graph recognition, and other fields.
Prediction of financial market trends
Financial phenomena and theoretical analysis
Over-expansion of credit is a suitable sign for financial deepening or a prelude to inevitable decline. The financialization phenomenon in the capital financial market is formed by the integration of the world economy. Due to the external fragility of finance, it has a certain impact on the financial market [7]. There is a negative correlation between the total economic output and credit growth rate, which is due to a negative response in the economy to credit growth rate. Generally speaking, there is still a positive connection between credit and an increase in production. The impact of “financial pressure” caused by information gap has led to a decrease in production and credit rating. Both total credit and poor information cannot predict a financial crisis. The information gap has improved at a foreseeable level. Scholars have started with tail risk in international financial markets, and this report analyzes the stock markets that have been impacted worldwide in order to identify systemic emergencies. During the process of unexpected events, the transmission of volatility in the world stock market and various securities markets also changes, and the correlation of volatility also increases [8].
During the financial crisis, the US Poor’s Index, oil prices, and gold prices were all affected to some extent. Stock prices were influenced by the combined effects of crude oil and the stock market, which had a significant impact on the long-term trend of the Poor’s Index. In addition, there is a significant positive correlation between the US Poor’s Index and oil prices, while there is a significant negative correlation with gold prices [9].
The various phenomena in the financial market are closely related to the behavior of market participants. Analyzing the behavior of these market participants is an important way to understand the laws of market operation. Examining investors’ investment behavior is an important way to understand their behavior [10]. Financial experts would study different types of investors, analyze the ways in which they have an impact on the financial market and other related markets, and the different characteristics of this impact in the financial market. It is possible to analyze and examine the main issues in asset pricing, discuss some new phenomena in the financial market, and examine the changes in financial asset prices and their reasons.
The current financial market in China is in a stage of economic development where the supply of funds is relatively scarce and the demand for funds is relatively strong. So there is a large demand for funds in China. This is because with the development of China’s economy and Economic restructuring, the economy would grow on a large scale in the next few years, and this growth would bring a large number of new investment needs [11]. In addition, in the coming years, due to the high savings rate and the fact that a significant portion of the savings rate is long-term savings, the banking system would continue to maintain a relatively high level of savings. With the increase of income level and the further deepening of Economic restructuring, the investment demand brought by China’s economic development would also further increase [12]. So currently, China is facing two contradictory situations: a relative shortage of funding supply and a relatively strong demand for funding. There are currently two financial market phenomena in China.
The first financial market phenomenon is the emergence of a large number of new financial instruments, institutions, and businesses in the past few years. These financial instruments and institutions can be referred to as “innovation” [13]. It is precisely because of these innovations that China currently has a large amount of unused funds, which play an important role in China’s economic development and Economic restructuring. The second phenomenon is due to the emergence of a large number of new institutional investors and investment vehicles in the capital market in the past few years. Since the 1970s, financial theory has flourished in the Western world, transitioning from traditional theoretical research to empirical analysis [14]. Due to the high complexity and uncertainty of the financial market, modern financial theories have made innovations in analytical methods: using new model methods to analyze the financial market, such as the incomplete hypothesis of the financial market, the portfolio selection theory and the option pricing model based on security selection. These models theoretically summarize the complexity and uncertainty of financial markets into five aspects, namely asset portfolio selection, option pricing, capital pricing, information asymmetry, and asset liquidity.
Since the 1980s, interest rate marketization has become an important trend in financial development worldwide. According to statistics on the “Financial Liberalization Index”, from 1981 to 2007, the degree of global financial liberalization continued to deepen [15]. Except for Japan and Germany, other major developed countries have achieved interest rate liberalization. At present, interest rate marketization reform is in full swing in Europe, and although the United States has not fully implemented interest rate marketization, it has begun to implement partial interest rate marketization.
Financial theory is a branch of economics that studies issues related to economic activities such as currency circulation, credit activities, capital market operations, and the operation of financial institutions. Financial theory can be roughly divided into two categories: one is about monetary and credit activities, and the other is about the operation of capital markets and the operation of financial institutions.
The hypothesis of market efficiency is an important component of contemporary financial economics. When the market effectiveness is “poor”, the noise in the stock market is high and its characteristics are very unstable, resembling a Brownian motion [16]. Therefore, constructing a forecasting model for the stock market is meaningless. So, from the beginning, classical research revolved around predictable stocks. If viewed from a long-term perspective, scattered data can be utilized to eliminate accidental factors. This can be transformed into a non-linear model that can predict the trend of the stock market. The trend of stock prices is difficult to predict. Linear regression theory based on random volatility can be used to study stock prices, with the main goal of predicting stock prices. However, practical applications have found that such models have very limited predictive effects on stock prices.
Financial market time forecast
Nowadays, people have attached great importance to predicting financial time series, but there is still a lack of effective methods for predicting it. In the current financial time series prediction, the LSTM NN is a relatively mature technology. Its storage capacity has inherent advantages in dealing with problems containing time series information. This network technology has been widely used in many fields related to time series, such as natural language processing, action recognition, speech recognition, financial time series prediction, etc. Compared with traditional NN, LSTM NN can fully leverage the advantages of selective memory, better reveal the inherent essence of stock market trends, and improve their prediction accuracy [17]. LSTM NN have better performance than classification algorithms withoutmemory.
Financial time series prediction simplifies the economic growth rate based on multiple indices such as mixed frequency, and introduces methods such as similarity and cutoff correction to improve the prediction accuracy of economic growth rate. Among these three methods, each has its own roots and characteristics. Comparing the initial forecast correction values with the forecast and forecast error values during the economic crisis and subsequent economic recovery process, the United States has the best forecast performance. In particular, the estimates of the revised economic growth rate for the first quarter are closer to the real situation, while estimates that have been corrected for other data are more accurate [18].
The use of financial indices in financial forecasting to determine relevant information is of great interest to various stakeholders when studying corporate performance. The financial forecasting method uses exploratory factor analysis to identify the potential dimensions of each indicator, and then uses predictive modeling to identify possible correlations between each indicator and performance [19]. Taking the Asian stock market as an example, empirical analysis can be conducted on the predicted volatility of financial markets. During the period from July 1, 2019 to August 31, 2020, the daily closing prices of stock indexes in various stock markets have been changing. The returns of securities have strong sustainability, and during periods of unexpected events, the returns show a decreasing trend [20]. The increase in stock market returns brought about by stock prices would increase employment rates and total wages in non trading industries, but would not have any impact on employment rates in the trading industry. In a financial forecasting model with regional differences, without the offset of monetary policy, overall labor spending in the United States would increase and working hours would increase after two years [21]. Financial forecasting can provide accurate warning of money laundering risks, which is of great significance for preventing and controlling crime, and also has a certain degree of temporal significance. Long and short term NN have been used to solve temporal problems, but they have high performance requirements for the model [22].
In the development of the stock market, classical mathematical statistics and artificial intelligence methods have been more and more applied. In the stock market, mathematical models established based on classical or only one method have low prediction accuracy due to their nonlinear characteristics. Therefore, it is necessary to develop a comprehensive and efficient forecasting method [23]. In finance, LSTM NN have been applied to financial stock market forecasting, trading execution strategies, and optimal portfolio. Stock market forecasting is a key application in this study [24]. Some scholars conduct financial prediction risk assessments on non-performing loans in the banking industry based on statistical data such as non-performing loans in China’s banking industry and non-performing loans in Shanghai’s banking industry. The relationship between China’s economic growth rate and average growth rate can be established by using LSTM NN [25].
In the study of time series prediction, feature fusion at the multi cycle scale is an important analytical tool. The use of LSTM NN for time series prediction of numbers usually only extracts features from a specific time period, ignoring data from other time periods within that time period, making it difficult to effectively utilize data from that time period [26]. In the prediction of financial time series classification, the reliability of category labeling (whether the category is reasonable or not) is the basis for the prediction. Whether it is set or not would have a significant impact on the internal correlation between the input and output of the system. On this basis, time series prediction analysis introduces the profit and loss ratio into category classification, taking into account the reliability of category classification and the value and importance of forecasting. This can build a scientific and efficient data modeling method and enhance the correlation in data. However, due to the impact of a large amount of noise, the pre and post correlation in financial time series has been severely affected, with some weak correlation patterns disappearing, resulting in a small number of noise samples accounting for the majority [27]. Due to the imbalance of data, the learning of this method becomes very difficult. In order to reduce adverse factors caused by uneven data, future research needs to be conducted from two aspects: data extraction methods and optimal selection of indicator weights.
Financial prediction model based on LSTM NN
Target tasks
By analyzing the changes in stock prices over the past year, the trend of stock price changes over the next year can be obtained. Specifically, it is to predict the trend and strength of future stock price trends through past stock price data.
Method route
In view of the characteristics of multiple periodic harmonics in economic data and the problem of quantitative labeling of prediction objects, this paper analyzes a prediction method based on LSTM NN [28]. In the process of learning, this article monitors profit indicators to retain outstanding process models; This article analyzes the improvement of the optimal indicator weight to enhance the importance of mainstream samples; Meanwhile, for various types of data, this article analyzes a “balanced” sampling method to solve the problems caused by various types of data imbalance.
Method advantages
Compared with conventional data analysis methods, the data analysis method analyzed in this article can better reflect the resonance characteristics of multiple periods in financial data, and compared with multi-scale data analysis methods such as wavelet, it is more periodic and easier to process and effective [29]. The model integrates the uncertain factors of the time and scope of financial asset pricing, and is closer to the object based pricing model compared to the object based pricing model and the feature based pricing model. Through a series of methods such as threshold adjustment, target weight optimization, and multi class sample equilibrium extraction, it is made more systematic and comprehensive compared to conventional methods [30]. In the past studies, the “overfitting” based on the loss error has led to poor prediction results; Therefore, this article analyzes the concept and calculation formula of profit indicators, and applies them to the monitoring of model training, providing a scientific basis for evaluating the performance of the model, and also bringing great convenience to the optimization of process models.
Model introduction
If the historical price time series of a stock is expressed as
Here
The expression of
On this basis, historical data within three time windows is used for retrieval to find the highest and lowest prices within each time period, and the minimum method is used to normalize each input parameter. The normalized result is calculated according to Eq. (3):
Within three different time windows, the highest price
The data of Shanghai Stock Price Index from January 1, 2011 to January 1, 2020 need to be discretization to obtain a training sample set. Traditional NN technology can be used to measure energy, combined with temporal energy, to ultimately establish a stock market situation structure model. At the same time, it can also obtain prediction results of stock market trend energy through LSTM NN algorithm. The prediction accuracy of different bands is shown in Table 1.
Prediction accuracy of different bands
Prediction accuracy of different bands
According to Table 1, the prediction accuracy of LSTM NN algorithm is generally higher than that of traditional NN algorithm. The average accuracy of traditional NN algorithm was 53.63%, while the average accuracy of LSTM NN algorithm was 55.88%. The average accuracy of using LSTM NN algorithm was 2.25% higher than that of using traditional NN algorithm.
Traditional NN algorithms comprehensively analyze the impact of multiple technical indicators from a system perspective, and have relatively high average accuracy in predicting stock market trends. The average accuracy in the up and down bands was as high as 59.07%. The average accuracy in the flat band was only 42.77%, which was higher than traditional NN that only use technical indicators. The LSTM NN algorithm considered the influence of temporal energy, with an average accuracy of 61.17% in the rising and falling bands, and an average accuracy of 45.3% in the flat band.
In order to conduct in-depth research on the consistency of the energy of the stock market situation, this article conducted statistics on the peak points included in the 9 time periods listed in Table 1. This article calculated the consistency rate between the closing index and the energy trend of the stock market situation at the peak point, and the results were shown in Table 2. The comparative analysis of the energy consistency rate results of the stock market situation is shown in Table 2.
Comparison and analysis of energy consistency rate results of stock market situation
From Table 2, it can be seen that the average energy consistency rate was 80.2% when the stock trend was upward, 90.19% when it is downward, and 95.3% when it was flat band. This method can effectively handle the contradiction between technology indices and market trends, especially when the market is in a flat band, this phenomenon is more significant.
This article selected a Shanghai stock exchange and recorded the price of the stock within 10 days. This article observed and analyzed the actual value of stock prices and the predicted values using traditional NN. The predicted stock prices using traditional NN algorithms are shown in Table 3.
Predicting stock prices using traditional NN algorithms
From the data in Table 3, it can be seen that the average stock price predicted using traditional NN algorithms was 60.2 RMB, while the actual value was 54.7 RMB. So traditional NN algorithms can be used to predict values that are too high, so investors would also bear higher risks.
However, LSTM NN algorithm has better stability through discretization of a few historical data. This model has good predictive ability and can effectively predict the periodic fluctuations of stock prices caused by market structure adjustments or changes. Its prediction effect is better than conventional traditional NN algorithms. The results of using LSTM NN algorithm to predict stock prices are shown in Table 4.
The result of forecasting stock price using LSTM NN algorithm
Iteration error rates of two algorithms
Specific stock index values for three scenarios.
From the data in Table 4, it can be seen that using the LSTM NN algorithm to predict stock prices resulted in a value of 57 RMB, which deviates slightly from the actual average value. Therefore, it can be concluded that using the LSTM NN algorithm has better prediction performance. In this case, the prediction results of the LSTM NN algorithm model analyzed in this article are the best. This also proves once again that discretization of a few continuous features can not only improve the stability of model prediction, but also improve the prediction accuracy of the model. The existing NN methods can only use a small number of continuity characteristics to predict the short-term stock market trend, and there is a “overfitting” problem. Although good results can be obtained on training samples, when there are multiple modes (such as local repetitive oscillations) in the experimental samples, their predictive ability would decrease.
When predicting the model established in this article, the traditional NN algorithm and LSTM NN algorithm were selected to analyze the error rate of the prediction, and the iterative error rate of the two algorithms was calculated within 100–1000 seconds. The iteration error rates of the two algorithms are shown in Table 5.
From the data in Table 5, it can be seen that the iteration error rate using traditional NN algorithms is relatively high, while the iteration error rate using LSTM NN algorithms is relatively low. So in actual prediction, LSTM NN algorithm should be selected as much as possible, so that the error rate is low when calculating financial data.
This article selects 10 sets of stock data for prediction analysis of their stock indices, compares the true values, and uses traditional NN algorithms and LSTM NN algorithms to predict the size of the stock indices. The vertical axis represents the number of data falling within a certain range, while the horizontal axis represents the size of the stock index. The specific stock index values for the three scenarios are shown in Fig. 1.
From the data in Fig. 1, it can be seen that when using the LSTM NN algorithm for prediction, the data is relatively close to the actual value. Compared to traditional NN algorithms, the LSTM NN algorithm fits the truth better and is closer to the truth. As the true value fluctuates, the intensity of the change becomes more significant.
As the economy experiences rapid growth, the financial market has garnered significant attention, underscoring the importance of predictive analysis in this domain. This article, after conducting a thorough examination of the limitations associated with traditional neural networks (NN), has adopted the Long Short-Term Memory (LSTM) NN algorithm to delve into the theories and phenomena within the financial market. Through this approach, a model for predicting financial market trends has been constructed. The Shanghai Composite Index served as the focal point for applying this model. Ultimately, by employing the model, this article has arrived at the following conclusion: the LSTM NN algorithm exhibits superior convergence efficiency and higher prediction accuracy, rendering it a more adept tool for application in the stock market context. In essence, the LSTM NN algorithm emerges as an effective method for predicting financial time series, with significant potential in this field.
