/discord-stock-ticker

Add live stock & crypto prices to your discord sidebar.

Primary LanguageGoMIT LicenseMIT

discord-stock-ticker

Live stock tickers for your discord server.

🍾 170+ tickers with over 4.6k installs across 680+ discord servers!

Releases MIT License

GitHub last commit GitHub stars GitHub watchers

Preview

Discord Sidebar w/ Bots

Join the discord server

Discord Chat

Support this project

Buy Me a Coffee

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!

Related Projects

Discord bot to create new tickers (avalible on the support server): https://github.com/rssnyder/discord-stock-ticker-bot

Cache-like system to get around coingecko api limits: https://github.com/rssnyder/coingecko-cache

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

Don't see a stock or crypto that you need? Open a github issue or join our discord server to use the broker bot!

Ticker creation bot

Stocks

x x x
aa arch lac.to
x scr.to bb
amc nok pfg
aapl amzn goog
gspc dji ixic
tsla dkng spy
sprq acic bmbl
plug fcel ipod
ipof amd nio
esgc gc=f si=f
cl=f pltr qqqj
pypl apha sndl
hut.to nhic rty=f
vix tnx cciv
hcmc ctrm etfm
sens ftcv mvis
cake chwy cmcsa
mstr ethe arkk
discb nvta msft
nflx fcx bidu
ttd gme scr
fubo dis buzz
bngo uavs arkg
es=f nq=f ym=f
arkx arkw arkf
v sq jpm
ma bac wfc
zb=f crl mnmd
c nvda comp
nsei brk-a nsebank
fb sol sos
mara ebon riot
ocgn bfarf hutmf
rkt btc tlry
ogi cidm roku
btbt omx tcnnf
trul adbe docu
lmt wmt cost
nya gold hd
iwm nkla sklz
coin snow

Crypto

x x x
bitcoin-cash ethereum dogecoin
monero litecoin ripple
polkadot cardano chainlink
stellar 0x balancer
iota reef-finance algorand
tezos ethereum-classic ravencoin
binancecoin ethernity-chain ecomi
reserve-rights-token aave ruler-protocol
polkamon uniswap bittorrent-2
tron vechain vethor-token
siacoin bitcoin illuvium
cosmos zilliqa pangolin
orion-protocol matic-network basic-attention-token
wink shiba-inu pancakeswap-token
graphlinq-protocol solana banano
raydium cope safemoon
nerve-finance lightning-protocol ftx-token
enjincoin quick decentraland
fantom spookyswap apeswap-finance
locgame coti casper-network
luck hbar wex
rope woo sushi
lyxe ele ksm
eos moonstar pekc

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 $1 per bot per month. You can choose a mix of cryptos and stocks and cancel at any time.

If you wish to host your bots on your own hardware, but need help getting set up, I also offer setup services for $20. I will install the service on your hardware and set you up with my internal tools to help manage your instances. This requires a running linux server.

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.

                                                                     +-----+    
                                                               ----> |yahoo|    
                                                     ---------/      +-----+    
               +--------------------+      ---------/                         
               |discord-stock-ticker|-----/                          +-------+  
+---------+    |                    |------------------------------> |discord|  
|ticker db|--->|                    |-----\                          +-------+  
+---------+    |                    |--\   ---------\                           
               +--------------------+   -----\       ---------\      
                                              --> +-----+      ----> +---------+
                                                  |redis|            |coingecko|
                                              --> +-----+      ----> +---------+
                    +---------------+   -----/       ---------/                 
                    |coingecko-cache|--/   ---------/                           
                    |               |-----/                                     
                    +---------------+                                           

Self-Hosting

Running in a simple shell

Pull down the latest release for your OS here.

wget https://github.com/rssnyder/discord-stock-ticker/releases/download/v2.0.0/discord-stock-ticker-v2.0.0-linux-amd64.tar.gz

tar zxf discord-stock-ticker-v2.0.0-linux-amd64.tar.gz

./discord-stock-ticker

Set options via ENV...

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

You can also show crypto price changes in percent, rather than USD movement:

export PERCENTAGE=1

To enable arrows in the ticker names to reflect price movements, set the arrows var:

export ARROWS=1

To have the seperator between name and price be a custom string, set the decorator:

export DECORATOR="@"

To have prices shows in another currency:

export CURRENCY=aud

Once all your options are set, simply run the binary:

./discord-stock-ticker

You can also specify the port to bind on (default is 8080):

./discord-stock-ticker -port 8000

Systemd service

The below script (ran as root) will download and install a discrod-stock-ticker service on your linux machine with the API avalible on port 8080 to manage bots.

wget https://github.com/rssnyder/discord-stock-ticker/releases/download/v2.2.0/discord-stock-ticker-v2.2.0-linux-amd64.tar.gz

tar zxf discord-stock-ticker-v2.2.0-linux-amd64.tar.gz

mkdir -p /etc/discord-stock-ticker

mv discord-stock-ticker /etc/discord-stock-ticker/

wget https://raw.githubusercontent.com/rssnyder/discord-stock-ticker/master/discord-stock-ticker.service

mv discord-stock-ticker.service /etc/systemd/system/

systemctl daemon-reload

systemctl start discord-stock-ticker.service

Adding multiple bots

A new feature in v2 is having one instance of the discord-stock-ticker manage multiple bots for different stocks and cryptos.

To add another bot to your instance, you need to use the API exposed on port 8080 of the host you are running on:

List current running bots

curl localhost:8080/ticker

Add a new bot

Stock Payload:

{
  "ticker": "pfg",
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "name": "2) PFG",  # string/OPTIONAL: overwrites display name of bot
  "frequency": 10,  # int/OPTIONAL: default 60
  "set_nickname": true,  # bool/OPTIONAL
  "set_color": true,  # bool/OPTIONAL: requires set_nickname
  "percentage": true,  # bool/OPTIONAL: show percent rather than USD change
  "arrows": true,  # bool/OPTIONAL: show arrows in ticker names
  "decorator": "@",  # string/OPTIONAL: what to show instead of arrows
  "currency": "aud",  # string/OPTIONAL: alternative curreny
}

Crypto Payload:

{
  "name": "bitcoin",
  "crypto": true,
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "ticker": "1) BTC",  # string/OPTIONAL: overwrites display name of bot
  "frequency": 10,  # int/OPTIONAL: default 60
  "set_nickname": true,  # bool/OPTIONAL
  "set_color": true,  # bool/OPTIONAL: requires set_nickname
  "percentage": true,  # bool/OPTIONAL: show percent rather than USD change
  "arrows": true,  # bool/OPTIONAL: show arrows in ticker names
  "decorator": "@",  # string/OPTIONAL: what to show instead of arrows
  "currency": "aud",  # string/OPTIONAL: alternative curreny
}

Example:

curl -X POST -H "Content-Type: application/json" --data '{
  "ticker": "pfg",
  "name": "PFG",
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxxx"
}' localhost:8080/ticker

Remove a bot

curl -X DELETE localhost:8080/ticker/pfg
curl -X DELETE localhost:8080/ticker/bitcoin

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-stock:
    image: ghcr.io/rssnyder/discord-stock-ticker:2.0.4
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - TICKER=gme
      - FREQUENCY=10  # OPTIONAL / seconds between price updates
      - STOCK_NAME=1. GME  # OPTIONAL / overrides name of bot
      - SET_NICKNAME=1  # OPTIONAL / uses server nickname to set price in bot name / requires "change nickname" perms
      - SET_COLOR=1  # OPTIONAL / change colors based on day change / requires "manage roles" perms and tickers-green & ticker-red roles
    
  ticker-crypto:
    image: ghcr.io/rssnyder/discord-stock-ticker:2.0.4
    container_name: discord-stock-ticker
    environment:
      - DISCORD_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - CRYPTO_NAME=bitcoin
      - FREQUENCY=10  # OPTIONAL / seconds between price updates
      - TICKER=BTC  # OPTIONAL / overrides name of bot
      - SET_NICKNAME=1  # OPTIONAL / uses server nickname to set price in bot name / requires "change nickname" perms
      - SET_COLOR=1  # OPTIONAL / change colors based on day change / requires "manage roles" perms and tickers-green & ticker-red roles
    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:2.0.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:2.0.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

Kubernetes

Thanks to @jr0dd there is a helm chart for deploying to k8s clusters. His chart can be found here

You can also use a simple deployment file:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    environment: public
  name: ticker-cardano
spec:
  replicas: 1
  selector:
    matchLabels:
      environment: public
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        environment: public
    spec:
      containers:
        - env:
            - name: CRYPTO_NAME
              value: cardano
            - name: DISCORD_BOT_TOKEN
              value: xxxxxxxxxxxxxxxxxxxxxx
            - name: FREQUENCY
              value: "1"
            - name: SET_COLOR
              value: "1"
            - name: SET_NICKNAME
              value: "1"
            - name: TICKER
              value: ADA
            - name: TZ
              value: America/Chicago
          image: ghcr.io/rssnyder/discord-stock-ticker:1.8.1
          name: ticker-cardano
          resources: {}
      restartPolicy: Always
status: {}
kubectl create -f deployment.yaml

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