https://discordapp.com/developers/applications/meand set up a bot account.
- Copy the Client/Application ID.
- Go to
- Authorize bot access to your desired server.
- Make sure you've done
pip install discord.pyand
pip install numpyin command prompt if you don't have them.
- Obtain bot token from the developer page.
- On btc_bot.py replace the bot-token placeholder in
bot.run('tokenhere')with a valid token.
The bot can now be run!
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.
The bot uses the prefix
Calling a command in the chat (example demonstrates initiating per-minute checking with a 1.5% threshold):
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.