Sentiment Analysis In Algorithmic Trading

By: Arya Brijith, International Center for AI and Cyber Security Research and Innovations (CCRI), Asia University, Taiwan,sia University, Taiwan,


The generic issue faced by people is automated trading and price fluctuation. Based on factors like the current market price of an option and hypothetical buy and sell prices, the automated trading system decides if an order should be issued. When trading in shares, buyers and sellers check the latest news on a company or an industry. Their perception of the information may differ, which will also influence their decision to buy or sell. Hence sentiment analysis serves as a crucial factor in shaping the predictions. It leverages the versatility of sentiment analysis, allowing for the extraction of valuable insights from substantial amounts of text-based data which in turn, equips businesses and organizations with a potent tool to make informed decisions and drive strategic growth.

Deep learning is a potent machine learning approach that provides cutting-edge prediction outcomes by learning numerous layers of representations or features of the data. Deep learning has been successful in many application fields, and in more recent years, sentiment analysis has also employed deep learning. This paper begins with an introduction to deep learning before offering a thorough study of the ways it is currently being used in sentiment analysis. Further, we shall discuss the relationship between sentiment analysis and algorithmic trading.


The stock market is a complex and dynamic financial environment that is affected by several variables. These include business performance, global events, economic indicators, and the overall sentiment of investors. Sentiment, plays a crucial role in shaping market trends. A powerful tool in harnessing and gauging this collective sentiment is sentiment analysis, a specialized branch of natural language processing (NLP) [1-3].

The fundamental idea behind using sentiment research in stock market forecasting is that shifts in sentiment, particularly when they coincide with important financial developments or news, may be used to predict stock market movements. These changes may influence investor behaviour and, as a result, stock prices. For instance, a significant spike in positive sentiment in response to a company’s earnings release might spark a surge in buying activity, propelling the price of its shares upward. This dynamic interaction between market movements and sentiment highlights an intricate shift that takes within the ecosystem of the stock market. From forecasting market swings based on Twitter mood to the ethical concerns of algorithmic trading, NLP models can analyse the intersection of technology, finance, and investor sentiment.

What is sentiment analysis?

The origins of sentiment analysis can be traced back to the broader domain of natural language processing (NLP). Natural language processing, a facet of artificial intelligence, aims to enable computers to understand, interpret, and generate human language in a way that is both meaningful and useful.

Sentiment analysis, involves the extraction and analysis of subjective information from various textual sources, such as news articles, social media posts, financial reports, and earnings call transcripts. By gauging whether the sentiment expressed in these texts is positive, negative, or neutral, analysts and machine learning algorithms can derive insights into market sentiment trends.

Word embedding results are needed as input features for many deep learning NLP models. It converts words in a lexicon to vectors of continuous real numbers as a method for language modelling and feature learning. The approach often entails embedding from a high-dimensional sparse vector space (for example, a vector space for one-hot encoding, where each word has a dimension) to a lower-dimensional dense vector space. The embedding vector’s many dimensions each correspond to a word’s latent feature. The vectors might represent language patterns and regularities.[4]

How investor sentiment affects stock prices

Investor sentiment has a significant impact on stock prices. Baker & Wurgler [11] explain that investor sentiment, which refers to beliefs about future cash flows and investment risks that are not justified by the available facts, affects stock prices. They argue that individual investors may underreact or overreact to past returns or fundamentals due to biases in their psychology, such as overconfidence, representativeness, and conservatism. Liu [12] supports this claim by stating that changes in investor sentiment can lead to asset price volatility, particularly during periods of low sentiment. Sayim et al. [13] also find that investor sentiment has an important impact on stock prices, using consumer confidence as a sentiment measure to predict time variation in stock returns.The effect of investor sentiment on stock prices is not limited to the US market. Hu & Wang [14] find that investor sentiment significantly affects the returns of stocks that are difficult to value and arbitrage in China. Bhatia et al. Bathia et al. [15] demonstrate that the sentiment of US individual investors propagates to international stock markets, particularly during the 2007 financial crisis. Wang et al. [16] study the relationship between investor sentiment and stock returns in China and find that investor sentiment affects stock returns, especially under different market conditions.The relationship between investor sentiment and stock returns is also observed in the Chinese stock market. and Zhang Li & Zhang [17] find a positive relationship between shifts in sentiment and stock returns, as well as a negative correlation between sentiment shifts and market volatility. Li [18] further supports this by showing that the proportion of negative emotions among investors can predict the closing price of the Shanghai stock index.Investor sentiment not only affects stock prices but also plays a role in various anomalies in cross-sectional stock returns. Stambaugh et al. [19] explore the role of investor sentiment in a broad set of anomalies and find that long-short strategies that exploit these anomalies generate consistent profits.In conclusion, investor sentiment has a significant impact on stock prices. It affects the behavior of individual investors, leads to asset price volatility, and influences stock returns in both domestic and international markets. Understanding and measuring investor sentiment is crucial for predicting stock market movements and exploiting anomalies in stock returns.

How sentiment analysis pertains to algorithmic trading?

Consider that you are in the middle of an earnings report. In event-driven trading, this is where sentiment analysis truly excels. It intervenes to determine the market’s perception of a firm at that crucial time. This insightful information may then direct your trading choices, offering you a tactical advantage during a significant financial event[20-21].

It is possible to forecast market movement using real-time Twitter data. We can perform predictions with the aim of acknowledging bitcoin and stock market activity using machine learning approaches. Sentiment analysis can be used by algorithms to dynamically modify portfolio allocations in response to shifting sentiment patterns. The model can learn and adapt to the trading strategies over time.


In the world of stock market prediction, where data reigns supreme and financial markets are as unpredictable as the weather, understanding the role of sentiment analysis is pivotal. As William Haight, a seasoned expert in finance and market behaviour, once said, “When investors learn new information about a company, it can make them want to buy or sell its stocks.”

In the ever-evolving landscape of financial markets, where information travels at the speed of light and investor sentiment can shift in an instant, sentiment analysis has emerged as a powerful tool with the potential to revolutionize stock market prediction. By employing natural language processing (NLP), it enables us to extract valuable insights from the vast sea of textual data generated by market participants. Traders and investors can harness sentiment data to make informed decisions, swiftly adapting to changing market conditions and identifying trading opportunities.


  1. Htun, H. H., Biehl, M., & Petkov, N. (2023). Survey of feature selection and extraction techniques for stock market prediction. Financial Innovation, 9(1), 26.
  2. Jorgenson, D. W., Weitzman, M. L., ZXhang, Y. X., Haxo, Y. M., & Mat, Y. X. (2023). Can Neural Networks Predict Stock Market?. AC Investment Research Journal, 220(44).
  3. Peñalvo, F. J. G., Maan, T., Singh, S. K., Kumar, S., Arya, V., Chui, K. T., & Singh, G. P. (2022). Sustainable Stock Market Prediction Framework Using Machine Learning ModelsInternational Journal of Software Science and Computational Intelligence (IJSSCI)14(1), 1-15.
  4. Zhang, L., Wang, S., & Liu, B. (2018). Deep learning for sentiment analysis: A survey. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery8(4), e1253.
  5. Colianni, S., Rosales, S., & Signorotti, M. (2015). Algorithmic trading of cryptocurrency based on Twitter sentiment analysis. CS229 Project1(5), 1-4.
  6. Kazemian, S., Zhao, S., & Penn, G. (2016, August). Evaluating sentiment analysis in the context of securities trading. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (pp. 2094-2103).
  7. Mehta, P., Pandya, S., & Kotecha, K. (2021). Harvesting social media sentiment analysis to enhance stock market prediction using deep learning. PeerJ Computer Science7, e476.
  8. Yadav, K., Gupta, B. B., Chui, K. T., & Psannis, K. (2020). Differential privacy approach to solve gradient leakage attack in a federated machine learning environment. In Computational Data and Social Networks: 9th International Conference, CSoNet 2020, Dallas, TX, USA, December 11–13, 2020, Proceedings 9 (pp. 378-385). Springer International Publishing.
  10. Gupta, B. B., Joshi, R. C., & Misra, M. (2012). ANN based scheme to predict number of zombies in a DDoS attack. Int. J. Netw. Secur.14(2), 61-70.
  11. M. Baker and J. Wurgler, “Investor sentiment in the stock market“, Journal of Economic Perspectives, vol. 21, no. 2, p. 129-151, 2007.
  12. T. Liu, “Research on the influence of economic policy uncertainty on stock market heterogeneity based on investor perspective“, Journal of Accounting Business and Finance Research, vol. 7, no. 2, p. 51-58, 2019.
  13. M. Sayim, P. Morris, & H. Rahman, “The effect of us individual investor sentiment on industry‐specific stock returns and volatility“, Review of Behavioral Finance, vol. 5, no. 1, p. 58-76, 2013.
  14. C. Hu and Y. Wang, “Noise trading and stock returns: evidence from china“, China Finance Review International, vol. 3, no. 3, p. 301-315, 2013.
  15. D. Bathia, D. Bredin, & D. Nitzsche, “International sentiment spillovers in equity returns“, International Journal of Finance &Amp; Economics, vol. 21, no. 4, p. 332-359, 2016.
  16. L. Wang, D. Ma, L. Tang, & J. Ma, “Influence of investor sentiment on stock returns- analysis of a- shares in china“, Neuroquantology, vol. 16, no. 6, 2018.
  17. X. Li and B. Zhang, “Stock market behavior and investor sentiment: evidence from china“, Frontiers of Business Research in China, vol. 2, no. 2, p. 277-282, 2008.
  18. L. Li, “Research on the transfer rules of internet users’ negative emotional state in financial public opinion“, Open Journal of Business and Management, vol. 08, no. 01, p. 282-301, 2020.
  19. R. Stambaugh, J. Yu, & Y. Yuan, “The short of it: investor sentiment and anomalies“, Journal of Financial Economics, vol. 104, no. 2, p. 288-302, 2012.
  20. Gupta, B. B., & Sheng, Q. Z. (Eds.). (2019). Machine learning for computer and cyber security: principle, algorithms, and practices. CRC Press.
  21. Gupta, B. B., Perez, G. M., Agrawal, D. P., & Gupta, D. (2020). Handbook of computer networks and cyber security. Springer10, 978-3.

Cite As

Brijith A. (2023) Sentiment Analysis In Algorithmic Trading, Insights2Techinfo, pp.1

53190cookie-checkSentiment Analysis In Algorithmic Trading
Share this:

Leave a Reply

Your email address will not be published.