Return to search

Using Twitter Attribute Information to Predict Stock Prices

Being able to predict stock prices might be the unspoken wish of stock investors. Although stock prices are complicated to predict, there are many theories about what affects their movements, including interest rates, news and social media. With the help of Machine Learning, complex patterns in data can be identified beyond the human intellect. In this thesis, a Machine Learning model for time series forecasting is created and tested to predict stock prices. The model is based on a neural network with several layers of Long Short-Term Memory (LSTM) and fully connected layers. It is trained with historical stock values, technical indicators and Twitter attribute information retrieved, extracted and calculated from posts on the social media platform Twitter. These attributes are sentiment score, favourites, followers, retweets and if an account is verified. To collect data from Twitter, Twitter’s API is used. Sentiment analysis is conducted with Valence Aware Dictionary and sEntiment Reasoner (VADER). The results show that by adding more Twitter attributes, the Mean Squared Error (MSE) between the predicted prices and the actual prices improved by 3%. With technical analysis taken into account, MSE decreases from 0.1617 to 0.1437, which is an improvement of around 11%. The restrictions of this study include that the selected stock has to be publicly listed on the stock market and popular on Twitter and among individual investors. Besides, the stock markets’ opening hours differ from Twitter, which constantly available. It may therefore introduce noises in the model. / Att kunna förutspå aktiekurser kan sägas vara aktiespararnas outtalade önskan. Även om aktievärden är komplicerade att förutspå finns det många teorier om vad som påverkar dess rörelser, bland annat räntor, nyheter och sociala medier. Med hjälp av maskininlärning kan mönster i data identifieras bortom människans intellekt. I detta examensarbete skapas och testas en modell inom maskininlärning i syfte att beräkna framtida aktiepriser. Modellen baseras på ett neuralt nätverk med flera lager av LSTM och fullt kopplade lager. Den tränas med historiska aktievärden, tekniska indikatorer och Twitter-attributinformation. De är hämtad, extraherad och beräknad från inlägg på den sociala plattformen Twitter. Dessa attribut är sentiment-värde, antal favorit-markeringar, följare, retweets och om kontot är verifierat. För att samla in data från Twitter används Twitters API och sentimentanalys genomförs genom VADER. Resultatet visar att genom att lägga till fler Twitter attribut förbättrade MSE mellan de förutspådda värdena och de faktiska värdena med 3%. Genom att ta teknisk analys i beaktande minskar MSE från 0,1617 till 0,1437, vilket är en förbättring på 11%. Begränsningar i denna studie innefattar bland annat att den utvalda aktien ska vara publikt listad på börsen och populär på Twitter och bland småspararna. Dessutom skiljer sig aktiemarknadens öppettider från Twitter då den är ständigt tillgänglig. Detta kan då introducera brus i modellen.

Identiferoai:union.ndltd.org:UPSALLA1/oai:DiVA.org:kth-299835
Date January 2021
CreatorsKarlemstrand, Roderick, Leckström, Ebba
PublisherKTH, Skolan för elektroteknik och datavetenskap (EECS)
Source SetsDiVA Archive at Upsalla University
LanguageEnglish
Detected LanguageEnglish
TypeStudent thesis, info:eu-repo/semantics/bachelorThesis, text
Formatapplication/pdf
Rightsinfo:eu-repo/semantics/openAccess
RelationTRITA-EECS-EX ; 2021:115

Page generated in 0.0016 seconds