Telegram Bot 🤖 that provides Stock Market information.
Message the bot on Telegram @SimpleStockBot
📝 Table of Contents
- About
- How it works
- Usage
- Getting Started
- Deploying your own bot
- Built Using
- Contributing
- author
- Acknowledgments
🧐 About
This bot aims to be as simple as possible while providing all the information you need on the stock market. The motivation of this bot is to provide similar stock market functionality that the Google Assistant provided in Google Allo before the project was sunset.
💭 How it works
This bot works by using the IEX API 2.0. Using various endpoints provided by the API, the bot can take either take commands from users or check any messages for stock symbols as detailed in Usage.
🎈 Usage
Basic Usage
The simplest way to use the bot is just by sending a message either as a direct message or in a group chat with the bot active. The bot will search every message for text with a dollar sign followed by a stock symbol, and it will return the full name of the company and the current trading price.
$tsla
The symbols can be anywhere in the message, and you can post as many as you like so commands such as:
I wonder if $aapl is down as much as $msft is today.
would return the stock price of both Apple and Microsoft like so:
The current stock price of Microsoft Corp. is $131.4, the stock is currently up 2.8%
The current stock price of Apple, Inc. is $190.15, the stock is currently up 2.66%
/dividend
To get information about the dividend of a stock type /dividend
followed by any text that has symbols with a dollar sign in front of them. So, the following command:
/dividend $psec
Would return information about Prospect Capitals dividend:
Prospect Capital Corp. Declares June 2019 Dividend of $0.06 Per Share
The dividend is in: 38 Days 3 Hours 53 Minutes 22 Seconds.
💡 you can also call the dividend command using /div
/news
To get the latest news about a stock symbol use /news
followed by any text that has symbols with a dollar sign in front of them. So, the following command:
/news $psec
Would return news for Prospect Capital:
News for PSEC:
Yield-Starved Investors Still Accumulating BDCs Paying More Than 10% Annually
Fully Assessing Prospect Capital's Fiscal Q3 2019 (Includes Current Recommendation And Price Target)
/info
To get information about a stock type /info
followed by any text that has symbols with a dollar sign in front of them. So, the following command:
/info $psec
Would return information about Prospect Capitals:
Company Name: Prospect Capital Corp.
Industry: Investment Managers
Sector: Finance
CEO: John Francis Barry
Description: Prospect Capital Corp. is a business development company, which engages in lending to and investing in private businesses. It also involves in generating current income and long-term capital appreciation through debt and equity investments. The company was founded on April 13, 2004 and is headquartered in New York, NY.
🏁 Getting Started
You can either choose to use the hosted version of the bot by clicking here or you can host your own bot with the instructions below.
Self Hosted Bot
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
This project runs neatly in a docker container, so all that you need to run it yourself is Docker installed on your system.
You will also need a telegram API key which can be obtained for free by talking to BotFather, more details here.
Finally, you will need and IEX Cloud API key. They offer a free tier that should be enough for any private groups, more details here.
Installing
Once Docker is installed and you have your API keys for Telegram and IEX Cloud getting the bot running on any platform is extremely easy.
Download or clone the repository to your machine and open a terminal in the project and build the Docker container.
docker build -t simple-telegram-bot .
Then run the bot using your API keys.
docker run --detach \
-e TELEGRAM=TELEGRAM_API \
-e IEX=IEX_API \
simple-telegram-bot
Your bot should be running! If you are new to Docker, I would recommend checking out its documentation for full control over your bot.
🚀 Deploying your own bot
I recommend Digital Ocean for small projects like this because it is straightforward to use and affordable. Sign up with my referral code, and we both get some free hosting.
⛏️ Built Using
- python-telegram-bot - Python Telegram API Wrapper
- Digital Ocean - IaaS hosting platform
✍️ author
- Anson Biggs - The one and only
🎉 Acknowledgements
- Telegram for having a great bot API
- IEX Cloud for offering a free tier
- Viewers like you ♥