🤖 A reddit bot that displays the last closing price information of a stock. Simply enter: $(stock ticker) and the bot will reply to you with the name of the company, closing price, 52 week high and low prices, weekly high and low, monthly high and low prices and the P/E ratio.
A convenient bot that displays a snippet of a stock by showing the full name of the company, last closing price (latest) and the 52 week high and 52 week low price, weekly high and low, monthly high and low prices.
Stock Info Bot uses the Alpha Vantage API for the closing price, weekly and monthly prices and Barchart API for 52 week prices. It uses Google Finance data to get the P/E ratio data.
The bot is running on Ubuntu 16.04 which is hosted on Amazon's AWS EC2. The reddit comment data is stored on Amazon's DynamoDB.
The bot first connects to reddit by logging in with the login credentials and reddit's client id and client secret. After successfully authenticating the bot, it scans all of reddit's comments to search for the keyword $(stock ticker) and whenever it finds it, it triggers the bot to reply.
The bot searches for the ticker symbol in the Pandas Dataframe (converted from a csv file) and then returns the stock ticker and the corresponding name of the company. It then uses Alpha Vantage's realtime API to get closing price information and returns the last closing price and weekly and monthly prices. It also uses Barchart's API (delayed by 15 minutes) to return the stock's 52 week high and low prices. It scrapes Google Finance data and gets the P/E ratio. After getting all the information necessary to reply to the original user, Stock Info Bot replies to the comment in under a minute.
The comment information is saved to DynamoDB afterwards.
The entire bot is written in Python 3.7
To use the bot, type the following in a reddit comment box:
> $NVDA
There has to be a $ in front of the stock ticker, otherwise it will not work.
The bot will then swiftly reply.
- PRAW - Reddit's Python wrapper
- Amazon AWS EC2 - Amazon AWS's cloud computing service
- Amazon DynamoDB - Amazon AWS's nonrelational database service
- Selenium - Browser Automation Library
- Alpha Vantage API - Alpha Vantage's realtime API
- Barchart API - Barchart's financial data API
- Pandas - Library for data manipulation and analysis
- Requests - Library for HTTP requests
- Time / DateTime / TimeDelta / PyTZ - Time libraries for time usage
- OS - Library to read/write files
- Sumit Agrawal
This project is licensed under the MIT License - see the LICENSE file for more details.
- Thank you to Datahub for providing the NASDAQ listing data in a clean, readable format.
- A big thank you to all the developers of the python libraries used in this bot.