CATEd - Cryptocurrency Analytics and Trading Engine for Django
Branch: master
Clone or download
pavellarenso and ongrid Improve README (#21)
Add LICENSE and improve README
Latest commit 5023b4a Sep 11, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
account/templates/account first commit Jun 15, 2017
djangoTrade Last stable version Apr 18, 2018
images Improve README (#21) Sep 11, 2018
templates first commit Jun 15, 2017
ticker_app Last stable version Apr 18, 2018
trade Last stable version Apr 18, 2018
tradeBOT Last stable version Apr 18, 2018
user_profile Last stable version Apr 18, 2018
.gitignore Last stable version Apr 18, 2018
LICENSE Improve README (#21) Sep 11, 2018 Improve README (#21) Sep 11, 2018 first commit Jun 15, 2017
dump.json Last stable version Apr 18, 2018 Last stable version Apr 18, 2018
requirements.txt Last stable version Apr 18, 2018

OnGrid Systems Blockchain Applications DApps Development

GitHub last commit PyPI - Python Version License

CATEd - Cryptocurrency Analytics and Trading Engine for Django


HabraHabr article in Russian

CATEd is the cryptocurrency trading bot written on Python 3 with feature-rich management Web interface (Django, Celery).

Main features:

  • View the status of exchange accounts, transactions and orders on them;
  • View the status of cold wallets and transactions details;
  • History of deposits and withdrawals on graphical diagram;
  • Configurable buy/sell/hold logic, (allowed tokens and proportions);
  • Keeping the balances of different tokens at the configured levels;




You need python3, mysql-server, rabbitmq-server and redis-server to be installed.

Create python virtual env and activate it in your favorite way.

Clone project

git clone

Go to project dir

cd CATEd

Create mysql databases

echo "create database trade character set utf8; create database celery_result; create database portal_ticker;" | mysql -u root

And migrate

python migrate

Load initial data with some exchanges and wallets

python loaddata dump.json

Create you own superuser with

python createsuperuser

Before starting the bot should read the list of currencies from the site To do this run following code with activated virtual environment.

read -d "" PYTASKS <<"EOF"
from tradeBOT import tasks
coinmarketcup = tasks.pull_coinmarketcup()
echo "$PYTASKS" | python shell

And runserver

python runserver

Now you can add your api keys.

Add NEW api keys for use bot.

To do this open in your browser, login and click red "plus" button in the lower right corner.

Bot uses several celery queues for trade, and main is triggered by a signal from a first worker named celery@worker_high. Another worker - worker_set_orders checks for already existing orders and try keeps them up to date. There are also queues low and normal, for calculating users' orders and pulling their balances.

You can run celery in several terminal windows or screen sessions:

celery worker -A djangoTrade -n worker_high -l info -c 1 -Q high
celery worker -A djangoTrade -n worker_set_orders -l info -c 1 -Q set_orders
celery worker -A djangoTrade -n worker_low -l info -c 2 -Q low
celery worker -A djangoTrade -n worker_normal -l info -c 2 -Q normal

Example of running celery with supervisor daemon:

wget -O /etc/init.d/celeryd
wget -O /etc/init.d/celerybeat
chmod +x /etc/init.d/celeryd /etc/init.d/celerybeat

#add celery config
read -d "" CELERYD_CFG <<"EOF"
CELERYD_NODES="worker_set_orders worker_low worker_normal worker_high"
CELERY_BIN="/opt/env/bin/python -m celery"
CELERYD_OPTS="-Q:worker_set_orders set_orders -Q:worker_low low -Q:worker_normal normal -Q:worker_high high -c:worker_set_orders 1 -c:worker_low 3 -c:worker_normal 3 -c:worker_high 1"
echo "$CELERYD_CFG" > /etc/default/celeryd

read -d "" CELERYBEAT_CFG <<"EOF"
CELERY_BIN="/opt/env/bin/python -m celery"
echo "$CELERYBEAT_CFG" > /etc/default/celerybeat

/etc/init.d/celeryd create-paths
/etc/init.d/celeryd start
/etc/init.d/celeryd stop
/etc/init.d/celerybeat create-paths
/etc/init.d/celerybeat start
/etc/init.d/celerybeat stop
sudo update-rc.d celeryd defaults
sudo update-rc.d celerybeat defaults



Copyright (c) 2018 OnGrid Systems.

Each file included in this repository is licensed under the MIT license.