/discord-stock-ticker

Add live stock & crypto prices to your discord sidebar.

Primary LanguagePythonMIT LicenseMIT

discord-stock-ticker

GitHub Super-Linter MIT License

GitHub last commit GitHub stars GitHub watchers

Support

Discord Chat Donate

Live stock tickers for your discord server.

Discord Sidebar w/ Bots

Love these bots? You can support this project by subscribing to the premium version or maybe buy me a coffee or hire me to write/host your discord bot!

Add free tickers to your servers (click the image to add)

Don't see a stock or crypto that you need? Join our discord or open a github issue to get new ones added!

WARNING: Due to an increase in usage, I am having to verify some bots. Discord is experiancing an influx in verification requests and thus there may be some bots that you are unable to add until the bot is verified. You can either try again later or join the discord to get alerted when these bots become requestable again.

Stocks

GameStop Blackberry AMC Theatres Nokia Principal Financial Group Apple Amazon Alphabet S&P 500 Dow Jones Industrial Average NASDAQ Composite Tesla Draftkings SPY SPRQ ACIC BMBL PLUG FCEL IPOD IPOF AMD NIO ESGC GOLD SILVER OIL PLTR CCIV HCMC _TNX _VIX RTY=F AA ARCH LAC.TO X SCR.TO QQQJ PYPL APHA sndl hut.to nhic ctrm etfm

Crypto

Bitcoin Bitcoin Cash Ethereum Dogecoin Monero Litecoin Ripple Polkadot Cardano Chainlink Cardano 0x Balance IOTA Reef Algo ETC RVN bnb ern omi

Premium

Discord Sidebar w/ Premium Bots

For advanced features like faster update times and color changing names on price changes you can subscribe to my premuim offering. I will host individual instances for your discord server at a cost of $5/month for a 5 pack of bots. You can choose a mix of cryptos and stocks and cancel at any time.

There is a full logging stack that includes loki & promtail with grafana for visualization.

If you are interested please see the contact info on my github page and send me a messgae via your platform of choice (discord perferred). For a live demo, join the support discord linked at the top or bottom of this page.

Really cool grafana dashboard

Self-Hosting

Install python for your target operating system.

Clone down the repo locally:

git clone git@github.com:rssnyder/discord-stock-ticker.git && cd discord-stock-ticker

Register a new application in the discord developer portal and copy the bot token:

export DISCORD_BOT_TOKEN=<token>

If you are watching a stock, enter the ticker symbol, and optionally you can set a custom name to appear instead of the symbol:

export TICKER=AAPL
export STOCK_NAME=Apple

If you are watching a crypto, enter the coin name as you want it to appear on your ticker, as well as the coin name/id for the coingecko API:

export TICKER=BTC
export CRYPTO_NAME=bitcoin

You can see coingecko coin names/id via their API (or enter the url in your browser):

curl -X GET "https://api.coingecko.com/api/v3/coins/list" -H  "accept: application/json"

You can optionally give your bot "change nickname" permissions to get around discord's limit on changing names only twice per two hours. Then you can set a custom amount of time between price updates (in seconds):

You must also make sure your bot has Change Nickname permissions to your server.

export SET_NICKNAME=1
export FREQUENCY=3

To enable color changing on price change, there is some setup needed. First you must create a new role to place the bots in. You need to check the Display role members seperatly from other online members option for this role, and do not assign a custom color for this role, leave it default.

Next you must create two roles called tickers-green and tickers-red . Do not check the Display role members seperatly from other online members option, but do set the colors for these roles to be green and red accordingly (or choose your own colors). These two new roles must appear below the general ticker role you created in the first step in the roles list.

You must also make sure your bot has Manage Roles permissions to your server.

Lastly, to enable the color changing, set SET_COLOR=1 in your environment:

export SET_COLOR=1

The colors will reflect the day price change, red for a loss and green for a gain. To flash the color of the price change every check (red for price decrease, green for increase) you can set FLASH_CHANGE:

export FLASH_CHANGE=1

Other options:

export LOG_FILE=log.log  # log to file instead of stdout
export POST_MARKET_PRICE=3  # display post market price instead of difference

Once all your options are set, simply install the dependencies and run the bot (virtual environments might be a smart idea):

pip3 install -r requirements.txt
python3 main.py

Docker

You can also run these bots using docker. This can make running multiple bots esier. Here is an example docker compose file for the basic feature set (please check for the latest release and update the tags accordingly):

---
version: "2"
services:
  ticker-pfg:
    image: ghcr.io/rssnyder/discord-stock-ticker:1.6.0
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - TICKER=PFG
    restart: unless-stopped
  ticker-aapl:
    image: ghcr.io/rssnyder/discord-stock-ticker:1.6.0
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - TICKER=AAPL
    restart: unless-stopped

And here is an example of enabling faster updates with color changes:

---
version: "2"
services:
  ticker-pfg:
    image: ghcr.io/rssnyder/discord-stock-ticker:1.6.0
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - TICKER=PFG
      - SET_NICKNAME=1
      - SET_COLOR=1
      - FREQUENCY=10
    restart: unless-stopped
  ticker-aapl:
    image: ghcr.io/rssnyder/discord-stock-ticker:1.6.0
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - TICKER=AAPL
      - SET_NICKNAME=1
      - SET_COLOR=1
      - FREQUENCY=10
    restart: unless-stopped
docker-compose-up -d

Support

If you have a request for a new ticker or issues with a current one, please open a github issue or find me on discord at jonesbooned#1111 or join the support server.

Love these bots? Maybe buy me a coffee! Or send some crypto to help keep these bots running:

eth: 0x27B6896cC68838bc8adE6407C8283a214ecD4ffE

doge: DTWkUvFakt12yUEssTbdCe2R7TepExBA2G

bch: qrnmprfh5e77lzdpalczdu839uhvrravlvfr5nwupr

btc: 1N84bLSVKPZBHKYjHp8QtvPgRJfRbtNKHQ