- Notifications
You must be signed in to change notification settings - Fork17
AI driven e-mail notifier for tweets mentioning stock from Elon Musk 📈
License
PiotrRut/elonmusk-twitter-notifier
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This little scripts uses thetweepy Python library, which is a wrapper around the Twitter API.It sets up a listener on the@elonmusk Twitter account, and automatically detects whenever Elon Musk posts a tweet mentioning the any of the specified keywords(or any words containing those as substrings).
It also uses AI object detection from images using aYOLO based model that I've custom-trained to detectobjects such as dogecoins, bitcoins, doge etc.. in the images.
When a new tweet that meets the conditions is read, this program will automatically e-mail me with the transcript of that tweet. For tweets containing an image that the AIclassifies as ones containing objects it's trained to detect, the image will be attached as well. This is a way for meto always be up to date with stocks that may soon rise in value 🤡
In order to run this locally, make sure you're Python interpreter is between v3.6 and 3.8 -this is due to the fact that Tensorflow won't work with newer versions. If you're on a newerPython version, consider downgrading withpyenv.
To install all the necessary dependencies, simply run the following command inside project root 👇🏻
$ pip install -r requirements.txt
Note:I havenot included my trained AI model in the repository due to the large file size -you can get it by navigating to thereleases tab, downloadingdoge-ai.h5
and placing it in the rootof the project.
If you would like to use this yourself, and receive juicy e-mail notifications every timeElon tweets, you can too! All you have to do is to have aTwitter Developer account and update the following environmental variables with yourTwitter API access keys:
# ./src/apiconfig.pyconsumer_key=os.getenv('CONSUMER_KEY')consumer_secret=os.getenv('CONSUMER_SECRET')access_token=os.getenv('ACCESS_TOKEN')access_token_secret=os.getenv('ACCESS_SECRET')
You will also have to update the following with your own e-mail details:
# ./src/emailsender.pymail_from=os.getenv('EMAIL_FROM')mail_to=os.getenv('EMAIL_TO')mail_pw=os.getenv('EMAIL_PW')
You might also have to update the SMTP server and port if you're not using Gmail.
Unless you want to keep this program running inside an open terminal instance forever, you should think aboutdeploying it somewhere. To do this, first find a platform that suits your needs, such as Heroku, Amazon AWS or MS Azure.
You need to remember to set the same config vars on the server as you've done locally, otherwisethe program won't work. You also need to make sure that you install all the necessary dependencies (tweepy) - for most platforms this is doneby specifying them inside therequirements.txt
file, but some services might need more. You will also have to make sure that your platform does not use Python above v3.8!
Some platforms also charge differently and offer different types of containers, so make sure you find one that suits your needs and doesn't cost much.
One thing to keep in mind is that because of the large size of the AI model, as well as the size of the tensorflow install, the overall bundle size gets quite big quite quickly. Some platforms(particularly Heroku) limit the bundle size you can deploy (for Heroku it's 500mb), and thus deployment can become troublesome.
may the stonks be ever in your favour
About
AI driven e-mail notifier for tweets mentioning stock from Elon Musk 📈
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.