# A Stock Prediction Method Based on Deep Reinforcement Learning and Sentiment Analysis
###### Abstract  
Most previous stock investing methods were unable to predict newly listed stocks because they did not have historical data on newly listed stocks. In this paper, we use the Q-learning algorithm based on a convolutional neural network and add sentiment analysis to establish a prediction method for Chinese stock investment tasks. There are 118 companies that are ranked in the Chinese top 150 list for two consecutive years in both 2022 and 2023. We collected all comments under the stock bar of these 118 stocks for each day from 1 January 2022 to 1 July 2024, totaling nearly 10 million comments. There are 90 stocks left after the preprocessing of 118 stocks. We use these 90 stocks as the dataset. The stock's closing price, volume, and comment text data are fed together to the agent, and the trained agent outputs investment behaviors that maximize future returns. We apply the trained model to two test sets that are completely different from the training set and compare it to several other methods. Our proposed method called SADQN-S obtains results of 1.1229 and 1.1054 on the two test sets. SADQN-S obtained higher final total assets than the other methods on both test sets. This shows that our model can help stock investors earn high returns on newly listed stocks. stock prediction; deep reinforcement learning; sentiment analysis; convolutional neural network; DQN +
Footnote †: journal:  
Most previous stock forecasting methods treat the stock problem as a time series modeling problem and choose to utilize statistically based methods to solve it [1,2]. In recent years, as the field of artificial intelligence has become hot, solving time series problems with machine learning-based methods has proven to have better results [3, 4, 5]. However, due to the large amount and complexity of stock market data, traditional machine learning methods cannot consistently and accurately predict the direction of the stock market. Deep reinforcement learning (DRL) is another method to building quantitative investment strategies. In 2015, Deepmind [6] combined deep learning (DL) and reinforcement learning (RL) in video games to achieve results beyond human levels. This was the beginning of deep reinforcement learning (DRL); since then, DRL began to be applied to various fields and showed strong learning ability and adaptability. In 2016, DeepMind applied DRL to the field of machine gaming with its development of AlphaGo [7], which defeated the world Go champion. The follow-up AlphaZero [8] beat AlphaGo again through self-learning. In addition, DRL algorithms have been applied by people in a variety of fields such as automatic intelligent machines [9, 10, 11, 12], text generation [13,14], text games [15], autonomous driving [16], and target localization [17], among others. Research from references [18, 19, 20, 21, 22] applies DRL to stock prediction. The experimental results in these papers demonstrate the feasibility of constructing stock prediction models using the DRL method. Research [18] applied deep reinforcement learning to global stock markets, greatly improving returns relative to before. Research [19] applied deep Q- network and deep recursive Q-network to stock trading. In the paper, an end-to-end daily stock trading system is constructed that decides to buy or sell on each trading day. Research [20] proposed a theory on the application of deep reinforcement learning in stock trading decisions and stock price prediction, demonstrating the reliability and usability of the model through experimental data. Research [21] proposed a multi-layer and multi-ensemble stock trader based on deep neural network and meta-learner to solve the stock prediction issue. Research [22] proposed two methods for stock trading decisions. Firstly, a nested reinforcement learning approach is proposed in this paper based on three deep reinforcement learning models. Then, a weight random selection with confidence strategy is proposed in the paper. The datasets of these methods are not the Chinese stock market.