Investor Sentiment Combined with Multisource Information to Predict Stock Prices: An Analysis of China’s A-Share Market

Investor sentiment has been widely used in the research of the stock market, and how to accurately measure investor sentiment is still being explored. With the rise of social media, investor sentiment is no longer only influenced by macroeconomic data and news media, but also guided byWe-Media and fragmented information.We take the data of China A-shares from January 2020 to December 2020 as the research object and propose a stock price prediction method that combines investor sentiment with multisource information. Firstly, the sentiment of macroeconomic data, brokerage research reports, news, and We-Media is calculated, respectively, and then the investor sentiment vector combining multisource information is obtained by the multilayer perceptron. Finally, the LSTM model is used to represent the stock time series characteristics. -e results show that (1) the proposed algorithm is superior to the benchmark algorithm in terms of accuracy and F1-score, (2) investor sentiment vector can effectively measure the investment sentiment of stocks, and (3) compared with vector concatenation, multilayer perceptron can better represent investor sentiment.


Introduction
Behavioral finance, which is derived from finance, psychology, communication, and behavioral science, believes that the stock price is not only determined by the intrinsic value of an enterprise but is largely influenced by the psychology and behavior of investors [1]. e idea in behavioral finance is that investors in markets are not completely rational people. In the process of investment decision-making, investors often cannot make a correct and reasonable judgment due to factors such as emotional preference and cognitive bias. In other words, investor sentiment reflects investor behavior and affects the final investment decision to some extent. Researchers try to explain market behavior from the perspective of investors. To verify the effectiveness of investor sentiment, Akerlof and Shiller [2] found a close relationship between investor sentiment and stock price by studying the volatility of investor sentiment and stock price. You and Wu [3] used the "spiral of silence" theory in media effect research of communication to study the impact of sentiment index on stock asset pricing from the perspective of media. Sentiment, as a factor affecting investors' psychological activities and then their behavior, has gradually become an important research issue in the task of stock price prediction.
Investor sentiment plays an important role in stock price forecasting. Song et al. [4] proposed a method for predicting stock excess returns that integrates research reports and investor sentiment, which can be verified in the Chinese A-share market to effectively improve the accuracy of the forecast. Li et al. [5] also conducted a similar study, and the difference is that the research object is the Hong Kong stock market. Polk and Sapienza [6] showed in their research that investor sentiment is similar to mispricing behavior in the stock market. Other views believe that investor sentiment is formed by the wrong estimation of asset value, which to a certain extent indicates the speculative propensity of investors [7]. Although the definition of investor sentiment has not yet reached a unified concept, it can be seen from different definitions that investor sentiment is an expectation of future stock returns, and due to investors' irrational behavior and reasons that are not completely based on fundamental analysis, investors will have certain deviations in their expectations [8].
In the current study, measures of investor sentiment can be divided into three categories. e first is the direct measurement method, which uses indicators obtained from market surveys to directly replace investor sentiment. e second is the indirect measurement method, which uses single economic variables and combination variables as proxy variables to measure investor sentiment. e third type uses the machine learning method to extract online text information in social media and further construct an investor sentiment index to measure investor sentiment. e information explosion and fragmented nature of the age of big data make it inadequate to use any of these measures alone to measure investor sentiment. In our opinion, the measurement of investor sentiment should take into account four factors simultaneously: macroeconomic conditions, brokerage research reports, news, and We-Media information. Based on this, we put forward a kind of multisource information fusion method to predict the price of the shares of investor's emotion; first, the sentiment of macroeconomic data, securities research reports, news, and the media is calculated, fusion of multisource information is obtained by concatenation operation ISV (Investor Sentiment Vector, ISV), and finally LSTM model is used to represent the stock time series characteristics. e contribution of this paper is as follows: (1) An investor sentiment measurement method integrating multisource information is proposed (2) e positive role of investor sentiment in the stock prediction task is verified (3) A stock price prediction framework is proposed based on deep learning e rest of this paper is organized as follows. Section 2 reviews investor sentiment measurement and its relationship with stock prices. Section 3 introduces our proposed method. Section 4 presents the experimental and details. Section 5 presents the experimental results and discussion. Section 6 gives our conclusions and directions for future work.

Related Works
With the continuous development of the Internet, the emergence of social media provides a new platform for users to search for information, express their feelings, and exchange opinions. Using social media indices as a proxy for investor sentiment has also become a convenient way to capture investor sentiment in the market. According to the Google search index, Da et al. [9] constructed the investor sentiment index through Google search keywords and found that the index could predict the short-term return and volatility of stocks. Meng et al. [10] use the Baidu search index to measure investor sentiment and find that investor sentiment has a linkage mechanism with the stock market. Although quantitative indicators are feasible in reflecting investors' attention to the stock market, they are difficult to measure more in-depth investor sentiment information [11].
With the rise of big data, text mining, machine learning, and sentiment analysis technologies, researchers can more quickly and accurately extract valuable information from texts for the construction of investor sentiment [12]. Oliveira et al.'s [13] research shows that investor sentiment extracted from social media platforms has a certain impact on stock prices, and social media also provides a large number of data sources for the construction of investor sentiment. Bollen and Mao [14] analyzed and compared the predictive ability of traditional investor sentiment metrics and social media and found that sentiment indicators extracted from social media have a better predictive effect. Sentiment indicators obtained from text analysis of social media content have been widely used in stock market prediction, but there is no consistency in research conclusions [15]. Ma and Zhang [16] believed that the inconsistent conclusions were caused by the difference in sample data selection and the accuracy of investor sentiment measurement. At present, the research is no longer limited to judging whether investor sentiment can predict the stock market. How to extract valuable information from a large amount of data and apply it to the construction of investor index has become the focus of the research.
Pröllochs et al. [17] analyzed the information in financial news media and found that the sentiment of negative sentences in financial news is correlated with stock prices. In terms of information usefulness, Sprenger et al. [18] point out that many professional and amateur investors and analysts use Twitter to post news comments and opinions, usually more frequently than professional news media. In terms of the speed of information transmission, Sul et al. [19] believe that investors' emotions transmitted through social media are more likely to affect stock prices quickly, while investors' emotions that spread more slowly take longer to affect stock prices and are more likely to predict prices in the next few days. In addition to Twitter, StockTwits [20] and Yahoo Finance [21,22] are also used to mine investor sentiment.

Method
We propose a stock price prediction method, including an investor sentiment module and a stock prediction module. e investor sentiment module separately calculates the four dimensions of macroeconomic status, broker report sentiment, news sentiment, and self-media sentiment through different methods and then obtains the ISV by MLP (multilayer perceptron) [23]. e stock prediction module consists of an LSTM [24], where the first input of LSTM is investor sentiment, and the subsequent input is the stock price. e method flow is shown in Figure 1.

Investor Sentiment Vector
3.1.1. Macroeconomic Status. MS (macroeconomic status) includes market status and economic status. For the market status, we select five indicators to measure the transaction volume (VOLUME), the number of new investor accounts (NEWIN), the consumer confidence index (CCI), the closed-end fund discount rate (FUND), and the market turnover rate (HS_TVR). e economic status is measured by four indicators: the resident consumption index (CPI), the amount of new credit (IC), the economic growth rate (GDP), and the money supply (M2). e macroeconomic status measurement can be divided into two steps. e first step is to calculate the preliminary sentiment index: Sentiment1. Specifically, first standardize the market state indicators, then perform principal component factor analysis on the indicators, and select the three principal components with the highest variance explanation as weights; finally, the factor load, that is, the coefficient of Sentiment 1 , is obtained after weighted average.
(1) e second step is to control the influence of economic state indicators and perform regression analysis on Sentiment 1 m , as shown in formula (2). e residual value ε m is the measurement index of macrosentiment (MS).
Among them, m is the month, α 0 is a constant, and α 1 ∼α 4 are the regression coefficients to be estimated.

Brokerage Report Sentiment.
Referring to the method proposed in the literature [4], we first split the brokerage research report into attention RRA k,t and rating sentiment RRRS k,t and then take the product of the two as the BRS (brokerage report sentiment), as shown the following equation: e difference is that attention in this paper is calculated daily (in literature [4], it is calculated monthly). Specifically, the attention index RRA k,t is constructed by the ratio of the absolute number of reports of stock k on that day to the total number of all reports of stock A-share market on that day. e calculation method is shown as follows: where N k,t is the total number of reports of stock k on day t and N A,t is the total number of reports of all stocks in the A-share market on day t. Stock k report rating sentiment (RRRS k,t ) comprehensively considers the two factors of base rating and rating change. Specifically, the assignment of base rating and rating change is shown in Table 1, and the calculation method is as follows: where R k,t is the base rating and C k,t is the rating change.
When there are multiple ratings for an individual stock in a single day, the research report ratings are averaged. Scientific Programming

News Sentiment.
News on the Web is a long text, and headlines alone cannot accurately and completely express the text. erefore, we first generate a summary of the news, obtain the accurate intention of the text, and then calculate the NS (news sentiment).
(1) News Summary Generation. We use the architecture of Seq2Seq [25] to generate the summary, where the encoder takes a sequence as input, encodes the information in the sequence as a semantic vector, and then outputs the summary text through the decoder. e model is shown in Figure 2. e encoder is bidirectional long short-term memory (Bi-LSTM) network. e input news is represented as . , x N , and we encode x into hidden state vectors with Specially, h N is the result of the merger of two-way last hidden states. e decoder part uses LSTM, whose initial state s 0 is the output h N of the encoder. On the step t, the decoder receives the previous decoder state s t−1 and the previously generated token y t−1 , and the decoder current state s t is calculated as follows: is method only uses s t to connect the encoder and decoder, so the encoder needs to compress the entire sequence information into a fixed-length vector, which is limited. As the length of the input sequence increases, the information entered first is diluted by the information entered later. For better decoding, we use the attention mechanism [26] to instruct the decoder to generate the next word through the probability distribution on the source word. e attention distribution a t can be calculated by s t and h i : where υ, W h , W s are learnable parameters and a t computes the context vector h * t : h * t contains decoding information, and we finally get the probability distribution P vocab of the output words through h * t : where V ′ and V are learnable parameters.
(2) News Sentiment Computing Based on Rules. Referring to the study of Qi [27], we construct relevant semantic rules to dig out the real emotions of semantic words in different contexts. Specifically, according to the number of semantic words, the text is divided into multiple clusters, and the emotional value of the text is the sum of the semantic values of the clusters. e calculation formula is as follows: where U a is the sentiment value of the cluster without negative words; U b is the sentiment value of the cluster with negative words; S is the semantic value of the emotional word; L s is the degree value of the degree adverb that modifies semantic words; L n is the degree value of the degree adverb that modifies the negative word; C n is the number of negative words. en, the average of all the news semantic of the day was calculated, namely, news semantic (NS).  the form of posts and replies, and the information they publish is usually short. After analysis, we believe that a post, including the post information and the reply information, represents the investment sentiment, so we combine the short text of the post and reply into a long text and calculate the sentiment of the long text. Refer to formulas (11)-(13) for WMS calculation.

Multisource Information Fusion.
We use a multilayer perceptron [23] to fuse the output of four different emotion vectors and then use the aggregate vector as the first input of the stock prediction LSTM. ISV calculation is as follows:

Stock Price Prediction Model Based on LSTM.
LSTM takes the output of the encoder as the input of t � −1 time step to guide the prediction of subsequent stock price, and the output m t−1 of LSTM at t − 1 time step is the input of t time step. In the training phase, for ISV and stock price S � (S 0 , . . . , S N ), the probability formula for predicting the stock price of the next trading day is as follows: where x −1 and x t , respectively, represent the inputs of LSTM in time steps −1 and t, S 0 represents the closing price of stocks at the beginning trading day, and S N represents the closing price of stocks in the end trading day. e loss function formula of the whole model is as follows: where I represents ISV.

Data and Preprocessing.
e experimental data were selected from January 1, 2020, to December 31, 2020, excluding new shares and long-term suspended stocks. All the web texts are captured by scrapy crawler framework and preprocessed by word segmentation and removal of stop words.
(1) Macroeconomic data: considering the lag of macroeconomic data, the data is selected from September 2019 to September 2020, and the data source is the WIND database (https://www.wind.com.cn/ NewSite/edb.html).
(2) Brokerage research reports: a total of 32724 reports on 2365 A-share companies released by 63 securities institutions are included. Data on the number of published reports, date of release, title, basic rating, and change of rating were obtained from East-money (https://www.eastmoney.com/). e brokerage rating confidence data are shown in Table 2 Figure 2: Abstract generation of a news text based on Seq2Seq.
Scientific Programming standardized according to the returns of the market in this period. To measure the advantages and disadvantages of the model from different perspectives, this paper selected SVM, LSTM model, RrmsNet [4], and SenticNet [5] as the benchmark methods for comparison with our work.

Metrics.
In the experiment, accuracy and F1-score are adopted to evaluate the performances of each method. Let n denote the total number of samples and N c denote the number of samples whose true label is c. ese metrics are defined as follows: accuracy � c∈y n cc N , P c � n cc n cc + p≠c n pc , R c � n cc n cc + p≠c n cp , where y � [1, 0, 0], [0, 1, 0], [0, 0, 1] { }, N c is the total number of samples in class c, N is the total number of samples, and n ij is the number of samples whose true label is i and the predicted label is j. P c and R c are precision and recall.

Main Result.
Due to the timeliness of information dissemination, we choose the 5th, 15th, and 30th as the window period for experimental observations. Table 3 shows the detailed results of the comparative experiment. In general, the method we proposed has achieved the best results in both accuracy and F1-score, which shows that investor sentiment vectors combined with multisource information can effectively improve the performance of stock price prediction. Figure 3 shows the accuracy and F1-score for different time windows. It can be seen from the figure that over time, the accuracy and F1-score of all methods have declined. Taking our method as an example, the accuracy rates on the 5th, 15th, and 30th days are 0.749, 0.693, and 0.668, respectively, and the F1-score are 0.723, 0.699, and 0.641, respectively.
ere are two reasons for this. First, all methods, no matter whether third-party information is included, are based on historical stock prices to predict future stock prices. As a result, the greater the time, the greater the uncertainty of the prediction. Second, investor sentiment based on the comprehensive calculation of different information is essentially an expression of information dissemination, so its influence on stock price prediction will weaken over time. is is consistent with the theory of information communication, that is, the longer the time, the weaker the influence of information.

Ablation Experiments.
To better observe the influence of MSI, BRS, NS, and WMS on the performance of stock price prediction, an ablation experiment was carried out in this paper. e main idea is to remove one of the above indicators, respectively, to obtain four models Without_MSI, Without_BRS, Without_NS, and Without_WMS. en, the accurate value and F1-score are compared with the Our_full model. e larger the difference, the greater the influence and contribution. e ablation results are shown in Table 4. In general, excluding any index, the accuracy and F1-score are lower than the Our_full model, which indicates that the four indicators measuring investor sentiment have a positive impact on the stock price prediction. Among them, the Without_BRS model excluding the BRS indicator has the largest gap compared with the Our_full model, which shows that, among the four indicators, BRS has the greatest impact on the stock price prediction. ere are two reasons. First, BRS, as a professional brokerage research report, is more easily recognized by shareholders. Second, compared with other sentiment indicators, brokerage research reports will directly give buy or sell recommendations, more direct.
Next, we remove the two indicators for further testing the performance of the model. Specifically, one is to get the Without_MSI_BRS model by removing MS and BRS simultaneously and the other is to get the Without_NS_WMS model by removing NS and WMS simultaneously. e reason for this is that MS and BRS information is more formal and comes from official or institutional sources, while NS and WMS information comes from news and comments on the Internet, which is more casual and free. e results show that the gap between the Without_MSI_ BRS and Our_full model is larger, which shows that although the amount of news and commentary information from the Internet is greater, the price of stocks is more affected by official economic indexes and brokerages.
Finally, we compare the influence of different fusion methods of four indicators on the stock price prediction. Concatenation model splices four indicators into one-dimensional vectors as LSTM inputs, and the results show that its performance is inferior to Our_full model, indicating that the fusion method proposed in this paper is more suitable for stock price prediction tasks.

Long-Term Stock Price Impact Analysis.
To examine whether there is a long-term effect on the impact of information on stock prices, we choose to conduct experiments on the 45th, 60th, and 90th window periods. e  Table 5. It can be seen from the table that the accuracy and F1-score of all methods are between 0.50 and 0.60, and it does not clearly show which method has better performance. rough the analysis of the case, it is found that, in the 45th, 60th, and 90th day time window after the information is released, the stock price performance of the predicted stocks is unstable and even presents a certain degree of randomness. First, the basic methods of stock price prediction in other models except SVM are all based on the LSTM model, and the LSTM model itself has the problem that the input sequence is too long and the gradient disappears. Further, the investor sentiment vector aggregated by our proposed method is used as the initial input of the LSTM model (t � 1). As the observation window expands to 45 days or even 90 days, the influence of investor sentiment vectors on subsequent time steps gradually weakens.
Second, in the self-media era, the update cycle of marketrelated information is relatively short. Among the four information sources we selected, the MSI cycle is updated monthly, the BRS update cycle is about 20 days, the NS update cycle is about 2 weeks, and the WMS is updated daily, as shown in Table 6. In other words, the longest period of all information is 30 days, which means that new news will overwrite old news and affect investors' decision-making.
Finally, China's A-share market is a semiclosed and immature market. Investors' decision-making is often affected by the latest information, leading to frequent transactions and short holding periods. According to statistics, the average holding period of individual investor accounts in the A-share market is less than 20 trading days; even for investment institutions, the average holding period is about 30-40 trading days. e characteristics of the market determine the direction of the market.

Scientific Programming
In summary, the investor sentiment vector calculated from the day of information collection has a limited impact on the stock price 45 days or even 90 days later, which is also the reason for the poor performance of the model.

Conclusion
e relationship between investor sentiment and the stock price has always been a hot research topic. In the era of big data, the channels for investors to obtain information have changed from research reports and news dominated by securities brokers to We-Media information. Multiple sources of information have brought new changes to measures of investor sentiment. Based on multisource information fusion, this paper proposes a new measurement method of investor sentiment and incorporates the new investor sentiment into the framework of stock price prediction. In the experiment with the data of China A-shares from January 2020 to December 2020, the results show that (1) investor sentiment is an important factor affecting stock price fluctuations, (2) among the different indicators of investor sentiment, brokerage report sentiment has the greatest impact on stock prices, and (3) multilayer perceptrons can better integrate emotional indicators.

Data Availability
All data in this paper come from public information on the Internet.

Conflicts of Interest
e authors declare that they have no conflicts of interest.