This Python module defines a trading model that leverages sentiment analysis and Long Short-Term Memory (LSTM) neural networks to predict stock price movements based on public opinion extracted from Twitter data.
pandas
numpy
matplotlib
sklearn
keras
(LSTM, Dense, Dropout, Sequential from keras.layers)vaderSentiment
(SentimentIntensityAnalyzer)
The model requires three data frames:
df_tweet
: Tweets data.df_company_tweet
: A mapping between tweets and companies.df_company
: Company information.Download Raw Data
: Google Drive
The Model
class contains all the methods needed to preprocess the data, perform sentiment analysis, train LSTM models, and plot results.
Create an instance of the Model
class by passing the required data frames as arguments:
model = Model(df_tweet, df_company_tweet, df_company)