# A Stock Prediction Method Based on Deep Reinforcement Learning and Sentiment Analysis
###### Abstract
There are fewer stock prediction models based on the Chinese stock market. Research [23] proposed a deep neural network model for predicting stock price movements. In the paper, knowledge graph and graph embedding techniques are used to select the related stocks of the target stock to construct the market information and trading information. Research [24] treated stock price charts as images and uses deep learning neural network for image modelling. The method proposed in the paper can predict the stock price movement in the short term. The datasets of research [23] and research [24] are both Chinese stock market. The rapid rise of the Internet has led people to browse information and express their opinions on major platforms every day, and most of these opinions are accompanied by the expression of positive or negative emotions, which will drive the emotions of the viewers. The remarks posted online by stock investors can influence the judgment of retail investors, which in turn affects stock prices [25, 26, 27, 28, 29]. Research [30] uses the advanced NLP technique BERTopic to analyze topic sentiment derived from stock market comments. Research [30] combines sentiment analysis with various deep learning models, and demonstrates through the paper's results that adding sentiment analysis to the models significantly improves the performance of these models. Thus, collecting information about these comments and analyzing the sentiment in them can help to predict the future direction of stock prices. In other words, adding sentiment analysis to stock prediction methods can lead to improved methods. In this paper, deep reinforcement learning and sentiment analysis are applied to the Chinese stock market. We combine deep reinforcement learning methods and sentiment analysis techniques to propose two new methods. These two methods are called SADQN-R (Sentiment Analysis Deep Q-Network-R) and SADQN-S (Sentiment Analysis Deep Q-Network-S) respectively. The contributions can be summarized as follows:* Data Innovation: Most of the datasets for stock prediction models come from the U.S. stock market, and there are fewer stock prediction models about China. However, there are huge differences between the Chinese stock market and the U.S. stock market, so the models applicable to other countries are not necessarily applicable to China. In order to get stable gains in the Chinese stock market, it is necessary to construct stock prediction models based on Chinese dataset. In this paper, 118 stocks are selected as the dataset. These 118 stocks are ranked among the top 150 stocks in China for two consecutive years in 2022 and 2023. The final experimental results show that our model can benefit from the Chinese stock market. * Method Innovation: Few studies have combined DRL and sentiment analysis to form stock prediction models. This paper uses the Q-learning algorithm based on convolutional neural networks to train stock prediction models, and adds sentiment indices as rewards (R) and states (S) into DQN, respectively, to obtain two models, SADQN-R (Sentiment Analysis Deep Q-Network-R) and SADQN-S (Sentiment Analysis Deep Q-Network-S). We tested the trained SADQN-R and SADQN-S on the test set and compared them with several other methods, and the results show that SADQN-S has the best performance among all methods. * Application Innovation: Most of the previous stock prediction methods use the historical data of a stock to predict the future direction of that stock. Newly listed stocks do not have historical data and cannot be predicted accurately. In this paper, the train set and test set are from different stocks. The test results show that our model applied to newly-listed stocks can achieve high returns. There are seven chapters in this paper. The first chapter is the introduction. We present in this section the applications of DRL in various fields and some stock prediction methods based on DRL. At the end of this chapter, we present the innovations of this paper. The second chapter is related work.