Finansiell sentimentanalys, utvärderad på aktiemarknaden
Sentiment analysis has emerged as a powerful tool for understanding public opinion in the financial domain. This thesis investigates whether Large Language Models (LLMs) can generate sentiment features that effectively predict next-day stock movements, comparing their efficacy against established state-of-the-art models. Data was retrieved by scraping social media platforms and news headlines. Sentiment scores were generated using three models: Gemini 1.5-flash, FinBERT, and DistilRoBERTa across four gathered datasets: X, Twitter, Reddit, and News headlines. These scores were then used as input features for three machine learning models: XGBoost, Multi-Layer Perceptron (MLP), and Long Short-Term Memory (LSTM) to predict the direction of next-day stock prices. The results show that sentiment-based features can effectively predict stock price direction, with the XGBoost model consistently achieving the highest predictive accuracy, exceeding 90% in some configurations. Among the sentiment analysis models, features generated by DistilRoBERTa most consistently led to the highest performing prediction models, indicating its superiority in generating meaningful sentiment signals for this task. FinBERT performed best on structured financial text, while Gemini demonstrated strong generalization on informal social media data. Overall, this work demonstrates the full stack of extracting, classifying, and engineering sentiment, and leveraging machine learning for financial forecasting and contributing to the development of more accessible tools for analyzing public opinion in stock markets.
Publication Details
- Journal
- KTH Publication Database DiVA (KTH Royal Institute of Technology)
- Published
- 2025-01-01
- Primary Topic
- Stock Market Forecasting Methods
- Type
- article
- Field-Weighted Citation Impact
- 0.00