Stock Price Prediction using Sentiment Analysis and Machine Learning

All Authors

Soneya Shakya, ENMU Sarbagya Ratna Shakya, ENMU

With the vast amount of data and improvement in computational capabilities, the prediction of stock prices has been an active area of interest. Apart from historical data of the stock, technical and fundamental data of the company, different macro financial parameters which represent the health of the company such as interest rate, GDP of the country, inflation rate, unemployment rate, oil price, etc., are prime factors that determine the stock market prices. Along with these factors, the movement of the stock price is highly reflected by the investor sentiments and confidence in the stock. In this study, we calculate the sentiments of the market and investors by analyzing tweets and news data related to four stocks: Amazon, Netflix, Apple, and Microsoft using different sentiment analysis tests. These scores from the sentiment analysis captured were used as a major parameter along with the historical stock price to predict the future stock movement and stock trend in different machine learning (ML) models such as K nearest neighbor (KNN), decision tree (DT), random forest (RF), and naïve Bayes (NB). The performance of the model was evaluated and compared using different performance metrics. Preliminary results show that RF has better performance as compared to the other ML models.