Tool to Leverage Social Media in Fundamental Research Process
I adapted a tool that relies on the Tweepy library to pull Twitter data, and the TextBlob library for simple NLP, to generate sentiment data for N number of tweets containing a given keyword. I believe this has a myriad of applications ranging from forecasting earnings reports with end-consumer data to predicting policy changes in government that will impact regulation in various industries.
I have attached the Python script to this post, as well as a link at the bottom to a research report I prepared on a US public equity using data the tool generated as a supporting set of evidence to support the investment thesis. I would love any feedback/improvements on the tool or the report, feel free to message here or contact me by email: [email protected]
from textblob import TextBlob
consumer_key = 'x'
consumer_key_secret = 'y'
access_token = 'z'
access_token_secret = 'a'
auth = tweepy.OAuthHandler(consumer_key, consumer_key_secret)
api = tweepy.API(auth)
public_tweets = api.search('Trump')
for tweet in public_tweets:
analysis = TextBlob(tweet.text)
This seems very interesting, I'd love to give it a try, I believe I can find the application for this in my business.