This is a cryptocurrency trading bot that sells coins on a pump and buys on a dump. Here is a basic concept of how it works:
- It places two limit orders: sell and buy.
- When one of the orders is complete, it cancels another one and creates new orders around new price.
pair_name
- the trading pair name that Kraken accepts ('XBTUSDT' for BTC/USDT pair)step
- difference in % between current price and sell/buy pricesbid
- amount of coins to sellbottom
- lowest price for trading, stop line for buyingceiling
- highest price for trading, stop line for selling
Let's talk about how calculates prices and amount for orders.
Sell order:
price = current_price * (1 + step/100)
amount = bid
Buy order:
price = current_price / (1 + step/100)
amount = bid * (1 + step/100)
As you can see, all generated income will be fixed in coins. If you want to fix your income in fiat - just change the source code to make your sell amount equal to bid.
This bot uses following stack of technology:
- Postgres database to manipulate strategies settings and store the state of the robot
- SqlAlchemy package to create easy to use ORM for easier and safer DB manipulations
- Krakenex package to get access to Kraken exchange API
- Telegram bot package to notify about fulfilled orders and errors
You need a running database. I used database on postgres, you are free to change DBMS, just be sure it is
supported by sqlalchemy
and you added required package to requirements.txt
You can find sql scripts:
database/create.sql
- script to create all necessary tablesdatabase/fill.sql
- script to add default strategies
- Install python3
- Install all requirements
pip install -r requirements.txt
- Create
.env
file using.env_example
as a reference. - Run
main.py
:
python main.py
You can build your own docker container. Just run following commands from root repo folder:
docker build -f Dockerfile -t [docker_hub_user]/[repo_name]:volatobot_v1 .
docker push [docker_hub_user]/[docker_repo_name]:volatobot_v1
To run container use the following command template:
docker run -d --restart unless-stopped \
--env db_settings=[your_database_url] \
--env kraken_api_key=[your_kraken_api_key] \
--env kraken_private_api_key=[your_kraken_private_api_key] \
--env telegram_api_key=[your_chat_bot_api_key] \
--env telegram_chat_id=[chat_id_in_your_telegram_bot_to_send_notifications] \
[docker_hub_user]/[docker_repo_name]:volatobot_v1