Discord Bot 🤖 that provides Stock Market information.
📝 Table of Contents
- How it works
- Getting Started
- Deploying your own bot
- Built Using
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.
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.
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%
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:
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 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.
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 Discord API key which can be obtained 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.
Once Docker is installed and you have your API keys for Discord 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-discord-bot .
Then run the bot using your API keys.
docker run --detach \ -e discord=DISCORD_TOKEN \ -e IEX=IEX_TOKEN \ simple-discord-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.
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.
- Anson Biggs - The one and only
- Discord for having a great bot API
- IEX Cloud for offering a free tier
- Viewers like you ♥