Skip to content
Discord Chatbot that tracks BTC Exchange Prices
Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes
.gitignore
README.md
btc_api.py
btc_bot.py
btc_stats.py
btcbotlogo.png
btcgraphic.gif

README.md

BTCBot Setup

To use:

  1. Visit https://discordapp.com/developers/applications/me and set up a bot account.
  2. Copy the Client/Application ID.
  3. Go to https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID_GOES_HERE&scope=bot&permissions=0.
  4. Authorize bot access to your desired server.
  5. Make sure you've done pip install discord.py and pip install numpy in command prompt if you don't have them.
  6. Obtain bot token from the developer page.
  7. On btc_bot.py replace the bot-token placeholder in bot.run('tokenhere') with a valid token.

The bot can now be run!

About

BTCBot is a chatbot that takes advantage of the Discord Python Library and QuadrigaCX API in order to report notable changes in the average Bitcoin exchange rate.

The bot uses polynomial regression to take residuals of all transactions in the last minute. After normalization (which can also be toggled), if the residual exceeds a certain threshold (1% of the average Bitcoin exchange rate by default) it will post a new message in the channel stating the gathered data and whether there were any abnormal changes in the transactions in that last minute.

If the user wishes, the bot can also alert them of any notable changes through direct messages notifications.

Important Notes About Reported Statistics

It should be noted that because the default check cycle occurs every minute, it is inevitable that the exchange average will fluctuate frequently. The live tracking per minute is mostly meant to see if anyone has made an "abnormal" transaction (based on the threshold) during that period of time.

When doing the check cycle, if there was no notable changes in that minute then you may see a Exchange price is fairly stable message under the new exchange average. This means that any changes in the exchange average are not abnormal, though "stable" in this context could also mean that the average is either slowly rising or falling in a somewhat constant rate. Remember - the bot's live tracking only accounts for steep changes via human transactions.

As a result, BTCBot also provides features such as obtaining the current market average and viewing the exchange statistics for the last hour in case you want a more accurate assessment of the market price. In the future there may also be an implementation that runs parallel to the current check command, but examines data each hour instead of each minute.

Commands

The bot uses the prefix $

Calling a command in the chat (example demonstrates initiating per-minute checking with a 1.5% threshold): $checkbtc 0.015

help - displays documentation in chat on how to use the bot.

checkbtc [optional threshold] - Begins checking each minute for Bitcoin value changes, based on a specified number between 0.0 and 1.0. However, it's recommended that the threshold remains 0.01 (1%). The threshold can be modified at any time by calling the command again with a different threshold.

pastdata [optional threshold] - Gathers Bitcoin data from the last hour based on desired threshold, which is 0.01 (1%) by default.

normtoggle - Toggled on by default. This toggles normalization of regression data. It's recommended to leave this on for more accurate results.

dmtoggle - Toggled off by default. Any user who toggles this on will receive direct messages from the bot whenever there has been a significant change in Bitcoin value.

avgbtc - Simply fetches the current average exhange value of Bitcoin.

botstop - Stops checking and logs the bot off from the server. If checking is ongoing, only the user that initiated checking can use this command.

You can’t perform that action at this time.