Skip to content

bsproul/discord-stock-ticker

 
 

Repository files navigation

discord-stock-ticker

Live stock and crypto tickers for your discord server.

Now with five different types of tickers!

🍾 400+ public tickers with over 15k installs across 3k discord servers!

Are you just looking to add free tickers to your discord server? Click the discord icon below to join the support server and get the list of avalible bots!

Releases MIT License

GitHub last commit GitHub stars GitHub watchers

Contents

Preview

imageTICKERSBOARDSimageHOLDERS

Join the discord server

Discord Chat

Support this project

Buy Me a Coffee

DigitalOcean Referral Badge

Love these bots? You can support this project by subscribing to the premium version, buying me a coffee, using my digital ocean referral link, or hiring me to write or host your discord bot!

Add free tickers to your servers

Stocks

bb | amc | nok | aapl | amzn | goog | ^gspc | ^dji | ^ixic | tsla | dkng | spy | amd | nio | gc=f | si=f | cl=f | pltr | pypl | sndl | rty=f | ^vix | arkk | msft | nflx | gme | dis | es=f | nq=f | ym=f | nvda | fb | btc | coin | ndaq | qqq |

Crypto

bitcoin | ethereum | bitcoin-cash | dogecoin | monero | litecoin | ripple | polkadot | cardano | chainlink | stellar | iota | reef-finance | algorand | tezos | ethereum-classic | ravencoin | binancecoin | ecomi | aave | uniswap | bittorrent-2 | tron | vechain | illuvium | cosmos | zilliqa | matic-network | basic-attention-token | shiba-inu | pancakeswap-token | solana | raydium | safemoon | ftx-token | enjincoin | decentraland | fantom | coti | hedera-hashgraph | sushi | kusama | eos | terra-luna | chia | theta-token | tether | smooth-love-potion | axie-infinity | harmony | cryptoblades | my-defi-pet | mist | weth | plant-vs-undead-token | cryptozoon | binance-usd | splinterlands | wax | coinary-token | avalanche-2 | cryptocars | binamon | wanaka-farm |

Gas Prices

Ethereum Invite LinkBinance Smart Chain Invite LinkPolygon Invite Link

Other (not my) crypto discord bots

image

Premium

For advanced features like faster update times and color changing names on price changes you can subscribe to my premuim offering.

Price per bot (paid monthly): $1

Price per bot (paid yearly): $10

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.

Self-Hosting - Docker

Grab the current release number from the release page and expose your designated API port:

docker run -p "8080:8080" ghcr.io/rssnyder/discord-stock-ticker:3.4.1

You can set the config via ENV vars, since we use namsral/flag the variables are the same as the flag inputs, but all uppercase:

When using the binary...

  -address="localhost:8080": address:port to bind http server to.
  -cache=false: enable cache for coingecko
  -db="": file to store tickers in
  -frequency=0: set frequency for all tickers
  -logLevel=0: defines the log level. 0=production builds. 1=dev builds.
  -redisAddress="localhost:6379": address:port for redis server.
  -redisDB=0: redis db to use
  -redisPassword="": redis password

When using env (docker)...

export ADDRESS="localhost:8080" # address:port to bind http server to.
export CACHE=false # enable cache for coingecko
export DB="" # file to store tickers in
export FREQUENCY=60 # set frequency for all tickers
export LOGLEVEL=0 # defines the log level. 0=production builds. 1=dev builds.
export REDISADDRESS="localhost:6379" # address:port for redis server.
export REDISDB=0 # redis db to use
export REDISPASSWORD="" # redis password
docker run -p "8080:8080" --env CACHE=true ghcr.io/rssnyder/discord-stock-ticker:3.4.1

Then you can pass a volume to store the state (and at the same time, upgrade to using docker-compose):

---
version: "3"
services:

  discordstockticker:
    image: ghcr.io/rssnyder/discord-stock-ticker:3.4.1
    environment:
      - DB=/dst.db
      - CACHE=true
    volumes:
      - /home/infra/dst.db:/dst.db
    ports:
      - "8112:8080"

Self-Hosting - binary

This bot is distributed as a docker image and a binary.

The program acts as a manager of one to many bots. You can have one running instance of the program and have any number of bots running within it.

Click here to watch a quick video tutorial on how to self-host these bots on linux.

If you are using windows and do not have a unix shell to use, you should use powershell. Here is an example of an API call using powershell:

$Body = @{
  name = "bitcoin"
  crypto = $true
  discord_bot_token = "xxxxxxxxxxxxxxxxxxxxxxxxx"
}
 
$Parameters = @{
    Method = "POST"
    Uri =  "127.0.0.1:8080/ticker"
    Body = ($Body | ConvertTo-Json) 
    ContentType = "application/json"
}

Invoke-RestMethod @Parameters

Roles for colors

To enable color changing you will need to create three roles.

The first role is the role the tickers will appear under. It can be named anything you want. You need to check the Display role members seperatly from other online members option for this role, but do not assign a custom color for this role, leave it default.

Then you need to make two other roles. These roles need to be named exactly tickers-red & tickers-green. Do not check the Display role members seperatly from other online members option for these roles, but do assign colors to these roles, red and green (or whatever color you want to represent gain/loss) respectively.

The last two roles tickers-green and tickers-red need to be below the first role in the role list in your server settings. You should then add all your ticker bots to the first role.

roles example

Using the binary

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-v3.3.0-linux-amd64.tar.gz

tar zxf discord-stock-ticker-v3.3.0-linux-amd64.tar.gz

./discord-stock-ticker

Setting options

There are options you can set for the service using flags:

  -address="localhost:8080": address:port to bind http server to.
  -cache=false: enable cache for coingecko
  -db="": file to store tickers in
  -frequency=0: set frequency for all tickers
  -logLevel=0: defines the log level. 0=production builds. 1=dev builds.
  -redisAddress="localhost:6379": address:port for redis server.
  -redisDB=0: redis db to use
  -redisPassword="": redis password

Systemd service

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

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

tar zxf discord-stock-ticker-v3.3.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

If you need to make modifications to the setting of the service, just edit the /etc/systemd/system/discord-stock-ticker.service file on the line with ExecStart=.

Now that you have the service running, you can add bots using the API exposed on the addres and port that the service runs on (this address is shown when you start the service).

Stock and Crypto Price Tickers

List current running bots

curl localhost:8080/ticker

Add a new bot

Stock Payload:

{
  "ticker": "pfg",                                  # string: symbol for the stock from yahoo finance
  "name": "2) PFG",                                 # string/OPTIONAL: overwrites display name of bot
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "decorator": "@",                                 # string/OPTIONAL: what to show instead of arrows
  "currency": "aud",                                # string/OPTIONAL: alternative curreny
  "activity": "Hello;Its;Me",                       # string/OPTIONAL: list of strings to show in activity section
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "twelve_data_key": "xxx",                         # string/OPTIONAL: use twelve data as source, pass in api key
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Crypto Payload:

{
  "name": "bitcoin",                                # string: name of the crypto from coingecko
  "crypto": true,                                   # bool: always true for crypto
  "ticker": "1) BTC",                               # string/OPTIONAL: overwrites display name of bot
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "decorator": "@",                                 # string/OPTIONAL: what to show instead of arrows
  "currency": "aud",                                # string/OPTIONAL: alternative curreny
  "currency_symbol": "AUD",                         # string/OPTIONAL: alternative curreny symbol
  "pair": "binancecoin",                            # string/OPTIONAL: pair the coin with another coin, replaces activity section
  "pair_flip": true,                                # bool/OPTIONAL: show <pair>/<coin> rather than <coin>/<pair>
  "activity": "Hello;Its;Me",                       # string/OPTIONAL: list of strings to show in activity section
  "decimals": 3,                                    # int/OPTIONAL: set number of decimal places
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

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

Restart a bot

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

Remove a bot

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

Crypto Market Cap

List current running bots

curl localhost:8080/marketcap

Add a new bot

{
  "name": "bitcoin",                                # string: name of the crypto from coingecko
  "ticker": "1) BTC",                               # string/OPTIONAL: overwrites display name of bot
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "decorator": "@",                                 # string/OPTIONAL: what to show instead of arrows
  "currency": "aud",                                # string/OPTIONAL: alternative curreny
  "currency_symbol": "AUD",                         # string/OPTIONAL: alternative curreny symbol
  "activity": "Hello;Its;Me",                       # string/OPTIONAL: list of strings to show in activity section
  "decimals": 3,                                    # int/OPTIONAL: set number of decimal places
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

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

Restart a bot

curl -X PATCH localhost:8080/marketcap/bitcoin

Remove a bot

curl -X DELETE localhost:8080/marketcap/bitcoin

Stock and Crypto Price Tickerboards

Tickerboards are tickers that rotate though several stocks or cryptos. This bot is a newer release, and is not as stable as the rest of the bots.

BOARDS

List current running Boards

curl localhost:8080/tickerboard

Add a new Board

Stock Payload:

{
  "name": "Stocks",                                 # string: name of your board
  "items": ["PFG", "GME", "AMC"],                   # list of strings: symbols from yahoo finance to rotate through
  "header": "1. ",                                  # string/OPTIONAL: adds a header to the nickname to help sort bots
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "arrows": true,                                   # bool/OPTIONAL: show arrows in ticker names
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Crypto Payload:

{
  "name": "Cryptos",                                # string: name of your board
  "crypto": true,                                   # bool: always true for crypto
  "items": ["bitcoin", "ethereum", "dogecoin"],     # list of strings: names from coingecko to rotate through
  "header": "2. ",                                  # string/OPTIONAL: adds a header to the nickname to help sort bots
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "arrows": true,                                   # bool/OPTIONAL: show arrows in ticker names
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

curl -X POST -H "Content-Type: application/json" --data '{
  "name": "Stocks",
  "frequency": 3,
  "set_nickname": true,
  "set_color": true,
  "percentage": true,
  "arrows": true,
  "discord_bot_token": "xxxxxxx",
  "items": ["PFG", "GME", "AMC"]
}' localhost:8080/tickerboard

Restart a Board

curl -X PATCH localhost:8080/tickerboard/stocks

Remove a Board

curl -X DELETE localhost:8080/tickerboard/stocks

Ethereum, BSC, and Polygon Gas Prices

These bots shows the current recommended gas prices for three types of transactions. You can choose either the ethereum, binance smart chain, or polygon blockchain.

image

List current running Gas

curl localhost:8080/gas

Add a new Gas

Payload:

{
  "network": "ethereum",                            # string: one of: ethereum, binance-smart-chain, or polygon
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

curl -X POST -H "Content-Type: application/json" --data '{
  "network": "polygon",
  "frequency": 3,
  "set_nickname": true,
  "discord_bot_token": "xxxxxxx"
}' localhost:8080/gas

Restart a Gas

curl -X PATCH localhost:8080/gas/polygon

Remove a Gas

curl -X DELETE localhost:8080/gas/polygon

Ethereum, BSC, or Polygon Token Holders

This bot lists the number of addresses that hold a particular token. You can choose from the ethereum or binance smart chain blockchains.

HOLDERS

List current running Holders

curl localhost:8080/holders

Add a new Holder

Payload:

{
  "network": "ethereum",                            # string: one of: ethereum, binance-smart-chain, or polygon
  "address": "0x00000000000000000000000000",        # string: address of contract for token
  "activity": "ethereum",                           # string: text to show in activity section of the bot
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

curl -X POST -H "Content-Type: application/json" --data '{
  "network": "ethereum",
  "address": "0x00000000000000",
  "activity": "Holders of MyToken",
  "set_nickname": true,
  "frequency": 120,
  "discord_bot_token": "xxxxxxx"
}' localhost:8080/holders

Restart a Holder

curl -X PATCH localhost:8080/holders/ethereum-0x00000000000000

Remove a Holder

curl -X DELETE localhost:8080/holders/ethereum-0x00000000000000

ETH/BSC/MATIC Token Price

This bot gets the current rate for a given token. You can choose another token to pair with on price, or by default USDC is used. You can choose either the ethereum, binance smart chain, or polygon blockchain.

List current running Tokens

curl localhost:8080/token

Add a new Token

Payload:

{
  "network": "ethereum",                            # string: network of token, options are ethereum, binance-smart-chain, or polygon
  "name": "my token",                               # string: display name of token
  "contract": "0x00000",                            # string: contract address of token
  "currency": "0x00000",                            # string/OPTIONAL: contract address of token to price against, default is USDC
  "set_nickname": true,                             # bool/OPTIONAL: display information in nickname vs activity
  "set_color": true,                                # bool/OPTIONAL: requires set_nickname
  "decorator": "@",                                 # string/OPTIONAL: what to show instead of arrows
  "activity": "Hello;Its;Me",                       # string/OPTIONAL: list of strings to show in activity section
  "source": "pancakeswap",                          # string/OPTIONAL: if the token is a BSC token, you can set pancakeswap here to use it vs 1inch; you can also set dexlab for solana tokens
  "frequency": 10,                                  # int/OPTIONAL: seconds between refresh
  "discord_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxx"   # string: dicord bot token
}

Example:

curl -X POST -H "Content-Type: application/json" --data '{
  "network": "polygon",
  "contract": "0x0000000",
  "frequency": 3,
  "set_nickname": true,
  "discord_bot_token": "xxxxxxx"
}' localhost:8080/token

Restart a Token

curl -X PATCH localhost:8080/token/polygon-0x0000000

Remove a Token

curl -X DELETE localhost:8080/token/polygon-0x0000000

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: {}

Louie

Since you have read this far, here is a picture of Louie at his favorite park:

PXL_20210424_185951005 PORTRAIT

About

Add live stock & crypto prices to your discord sidebar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.4%
  • Other 0.6%