/slackCryptoBot

A slack bot for crypto currency monitoring using python and ccxt

Primary LanguagePython

alt text

This slack bot will allow you to monitor any crypto currency trading on any major exchanges. It uses ccxt as well as pymarketcap to fetch all the information. It allows the user to check the current price, set alarms and as well as generating image for the top gainers/losers. Eventuall I would like to implement graphing feature such as candlesticks,RSI,MCAP....

The bot uses flask on the backend and as well as celery + rabbitmq to process requests. It should in theory allows multiple users to make requests to the bot. I currently have it deployed on a RPi 2.

Setup

Let's encrypt installation

Follow the official guide

Installation

sudo apt-get install rabbitmq-server
sudo pip3 install -r requirements.txt

In main.py, add the certificates generated by let's encrypt in '/YOURPATH/fullchain.pem', '/YOURPATH/privkey.pem'

In coinmarkets.py, add your slack app's webhook to "self.webhook"

In tasks.py, add the public ip of the host machine in "host"

Pymarketcap installation

git clone https://github.com/mondeja/pymarketcap.git
cd pymarketcap
python setup.py install

Port Forwarding

By default the program runs on port 7000, you will need to open this port on your router

Slack app setup

Webhook

Generate new slack webhook

Slash commands

All request URLs should be https://YOURPUBLICIP:7000/slack

/alert [coin symbol][price $ or %][market(default=coinmarketcap)]   sets a new alert for a coin  eg: /alert BTC 10% bittrex
/topten           						    topten coins update from coinmarketcap
/symbols							    list all supported coins symbols
/gainers [timeframe (1h|24h|7d)]				    list top gainers from coinmarketcap eg: gainers 24h
/losers [timeframe (1h|24h|7d)]					    list top losers from coinmarketcap
/updatecoin [coinSymbol] [market(optional) or all]                  list current price of coin  eg: /updatecoin ETH poloniex
/removealert [timestamp]					    remove alert with alert's timestamp eg: /removealert 1508131691
/showalert [all]						    show all alerts created by the requesting user, if all is 	typed, then show all alerts

Running

celery -A tasks worker --loglevel=info
sudo python3 main.py