Skip to content

The purpose of this Discord bot is to pull the close prices for user-defined list of assets (cryptocurrencies, stocks, etc.) for a select number of last days and display them in a plot in a relative manner.

License

Notifications You must be signed in to change notification settings

aljazfrancic/stonks-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

The purpose of this Discord bot is to pull the close prices for user-defined list of assets (cryptocurrencies, stocks, etc.) for a select number of last days and display them in a plot in a relative manner.

The close prices for the first asset on the list are also shown.

Note

The images below are updated automagically via GitHub Actions every hour!

Usage

To use the bot, send it a direct message on Discord or post in any channel the bot has access to on a Discord server that the bot is in. The message should conform to the following guidelines.

Default settings (365 days, using tickers X:BTCUSD, X:ETHUSD, X:XMRUSD):

!stonks

will produce: example 1

Default settings with user-defined number of days:

!stonks <number of days>

for example:

!stonks 3

will produce: example 2

!stonks 14

will produce: example 3

Custom input:

!stonks <number of days> <tickers with spaces>

for example:

!stonks 365 X:BTCUSD GOOG NVDA AAPL

will produce: example 4

Tip

In terms of tickers, mixing cryptocurrencies and stocks is allowed!

Installation

  • Install latest Python
  • Run pip install -r requirements.txt

Running as a Discord bot

  • Run python bot.py

Running locally

Important

All the Discord commands listed under Usage will work locally if you cd into project location and substitute !stonks with python stonks.py!

However, for this to work, you must provide a polygon.io API key, which you can acquire for free on their website. Then create a file named .env and paste your polygon API <key> into it like so:

POLYGON=<key>
  • Run python stonks.py

With some additional parameters:

python stonks.py 365 X:BTCUSD GOOG NVDA AAPL

TODO

  • Add Discord Application guide to README.md
  • Automatic deployment to AWS EC2 via GitHub Actions
  • Overall code quality improvements

About

The purpose of this Discord bot is to pull the close prices for user-defined list of assets (cryptocurrencies, stocks, etc.) for a select number of last days and display them in a plot in a relative manner.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages