dabo/README.md

204 lines
7.5 KiB
Markdown
Raw Normal View History

2023-04-28 17:07:43 +02:00
# Warning / Disclaimer
The software provided here does not guarantee any profits or function as well as sufficient security. Use at your own risk!!!
This is a private project, which is based on amateur knowledge. Trading cryptocurrencies involves an enormous amount of risks and is considered highly speculative.
It is strongly recommended to deal intensively with the subject and this bot before using it. Also, when using the possibility should be considered that due to an unfavorable market development, technical errors, bugs or other reasons, the entire invested capital can be lost. This software should therefore only be used if it is justifiable to lose the entire invested capital!
# Objective
2023-04-28 17:24:32 +02:00
The dabo-bot is intended to help make and execute timely buy and sell decisions automatically in the fast-paced crypto environment. It is to be invested in the case of larger increases in value and investments are to be sold again when the prices fall, so that price gains are taken and losses are minimized.
# Naming
The name Dabo comes from the Star Trek universe.
Dabo was a roulette-style game of chance developed by the Ferengi.
More information here:
https://memory-alpha.fandom.com/wiki/Dabo
I thought this fits quite well to the cryptotrading world and that's why i chose this name ;-)
2023-04-28 17:07:43 +02:00
# Features
## General:
2023-05-07 23:09:40 +02:00
- Compatible with the following crypto exchanges: Binance, Bitpanda
2023-04-28 17:07:43 +02:00
- Consideration of trading fees
- Automatic selection of cryptocurrencies to invest in
- Filtering of cryptocurrencies by market capitalization (data via coingecko API) e.g. only trade the 50 largest by market capitalization if available on the exchange
- Notifications via Signal Messenger to groups
- Individually selectable percentage of available capital per trade
- automatic definition of time intervals (e.g. every minute / every five minutes) based on the change of the rates
- Monitoring of overall market performance via own market performance index based for example on the MACI World, leading currencies like BTC and ETH and their forecasts.
- Emergency stop if balance falls below defined value
- Recording of available price values incl. RSI and MACD indicators of available cryptocurrencies
- Analysis tool for collected historical values to try out buy or sell conditions based on them
- ReadOnly web interface for overview
2023-05-09 17:04:02 +02:00
- Runnable in a non-root docker containe
- multiple different buy and sell strategies possible at the same time
2023-04-28 17:07:43 +02:00
## Buy conditions
- definable RSI Indicator signals min/max (RSI5, 14 and 21)
- definable MACD signals min/max
- definable minimum growth in a definable time period
## Sell conditions
- sell at defined loss limit
- hold if the result would be negative
- sell after certain time even if loss exists
- definable RSI Indicator signals min/max
- definable MACD signals min/max
# How to use/install
Linux knowledge required!
Needed a running Docker install. Traefik suggested, see
2023-05-09 12:04:13 +02:00
https://gitea.ds9.dedyn.io/olli/debian.ansible.docker
2023-05-09 12:04:13 +02:00
https://gitea.ds9.dedyn.io/olli/debian.ansible.traefik.server
2023-05-09 12:04:13 +02:00
2023-05-09 17:04:02 +02:00
## Download
2023-04-28 17:07:43 +02:00
```
2023-04-28 17:24:32 +02:00
git clone https://gitea.ds9.dedyn.io/olli/dabo.git
cd dabo
2023-04-28 17:07:43 +02:00
```
2023-05-02 10:49:04 +02:00
2023-05-09 17:04:02 +02:00
## Build container
2023-05-02 10:49:04 +02:00
```
docker -l warn compose --ansi never build --progress=plain --pull --no-cache --force-rm
```
2023-05-09 17:04:02 +02:00
## Configure
Edit docker-compose.yml or create docker-compose.override.yml to fit yout needs e.g. domain and network settings or basic auth, e.g. for traefik and letsencrypt:
```
echo '
services:
dabo-bot:
networks:
- YOURNETWORK
dabo-web:
labels:
2023-05-09 10:57:14 +02:00
- traefik.enable=true
# DOMAIN
- traefik.http.routers.dabo-YOURINSTANCENAME.rule=Host(`YOURDOMAIN`)
- traefik.http.routers.dabo-YOURINSTANCENAME.entrypoints=https
- traefik.http.routers.dabo-YOURINSTANCENAME.tls=true
# Proxy to service-port
- traefik.http.services.dabo-YOURINSTANCENAME.loadbalancer.server.port=80
- traefik.http.routers.dabo-YOURINSTANCENAME.service=dabo-YOURINSTANCENAME
# cert via letsencrypt
- traefik.http.routers.dabo-YOURINSTANCENAME.tls.certresolver=letsencrypt
# activate secHeaders@file & basic auth
2023-05-09 10:57:14 +02:00
- traefik.http.routers.dabo-YOURINSTANCENAME.middlewares=secHeaders@file,dabo-YOURINSTANCENAME-basicauth
# Generate crypted password string with: echo $(htpasswd -nB YOURUSER) | sed -e s/\\$/\\$\\$/g
2023-05-09 10:57:14 +02:00
- traefik.http.middlewares.dabo-YOURINSTANCENAME-basicauth.basicauth.users=YOURUSER:YOUR-GENERATED-CRYPTED-PASSWORD-STRING
# Traefik network
- traefik.docker.network=traefik
networks:
- traefik
networks:
YOURNETWORK:
driver: bridge
driver_opts:
com.docker.network.bridge.name: YOURBRIDGE
traefik:
external: true
' >docker-compose.override.yml
```
2023-05-09 11:14:32 +02:00
Optional: If you use signal-cli (https://gitea.ds9.dedyn.io/olli/debian.ansible.signal-cli.client) and want do receive Signal-Messages from the bot you can create an SSH-Key to allow sending Signal-Messages e.g.:
```
2023-05-09 12:04:13 +02:00
mkdir -p home/.ssh
2023-05-09 11:14:32 +02:00
ssh-keygen -f home/.ssh/id_ed25519 -N "" -t ed25519
2023-05-09 12:04:13 +02:00
chmod 700 home/.ssh
2023-05-09 11:14:32 +02:00
cat home/.ssh/id_ed25519.pub
```
and add Key on your signal-cli-Server to the authorized_keys of the signal-User
Create Secrets file for your API Key(s)
```
# for Bitpanda
echo 'local API_TOKEN=YOUR_VERY_LOOOOOOONNNNGGGG_API_TOKEN_FROM_BITPANDA' >dabo/.bitpanda-secrets
2023-05-09 12:05:14 +02:00
chmod 400 dabo/.bitpanda-secrets
# or for Binance
echo 'local API_SECRET="YOUR_LONG_API_SECRET_FROM_BINANCE"
local API_KEY="YOUR_LONG_API_KEY_FROM_BINANCE" '>dabo/.binance-secrets
2023-05-09 12:04:13 +02:00
chmod 400 dabo/.binance-secrets
```
2023-05-09 17:04:02 +02:00
Create Config
Especially set URL, STOCK_EXCHANGE, FEE, CURRENCY,... to fit your needs.
```
2023-05-09 17:04:02 +02:00
vim dabo-bot.conf
```
2023-05-09 17:04:02 +02:00
Defaults in dabo/dabo-bot.conf
2023-05-09 11:14:32 +02:00
2023-05-09 17:04:02 +02:00
## Prepare/Create a stretegy
2023-05-09 10:31:47 +02:00
2023-05-09 17:04:02 +02:00
IMPORTANT!!!
2023-05-09 17:04:02 +02:00
THE DEFAULT STRATEGY MAY NOT FIT YOUR NEEDS OR WORK PROPERLY. SO YOU CAN LOOSE ALL YOUR MONEY!!! USE ON YOUR OWN RISK!!!
2023-05-09 17:04:02 +02:00
TEST YOUR OWN STRATEGY COMPREHENSIVELY AND OVER A LOGNER PERIOD OF TIME WITH analyze.sh!!! USE ON YOUR OWN RISK!!!
Strategie files can be put in the "strategies"-directory the defaults
There is an example for a buy and a sell strategy file (deactivated by "return 0" in the forst line):
```
ls strategies/buy.example.conf
ls strategies/sell.example.conf
```
Aditional strategies can be created with Name
```
strategies/buy.<name>.conf
strategies/sell.<name>.conf
```
e.g named "mannover-sulu-1" for buy strategy and "command-kirk-3" for sell strategy
2023-05-09 12:04:13 +02:00
```
2023-05-09 17:04:02 +02:00
strategies/buy.mannover-sulu-1.conf
strategies/sell.command-kirk-3.conf
2023-05-09 12:04:13 +02:00
```
2023-05-09 17:04:02 +02:00
## Set Rights
Set Rights (UID 10000 for non-root-User in running container):
```
2023-05-09 17:23:46 +02:00
chown -R 10000:10000 dabo data home strategies dabo-bot.conf
2023-05-09 17:04:02 +02:00
```
2023-05-09 12:04:13 +02:00
2023-05-09 17:04:02 +02:00
## Operational commands
Run/Restart:
2023-05-02 10:49:04 +02:00
```
2023-05-09 17:04:02 +02:00
docker compose down # if an old instance is running
docker compose up -d
2023-05-02 10:49:04 +02:00
```
2023-05-09 17:04:02 +02:00
Check
```
docker compose ps
```
2023-05-09 11:14:32 +02:00
Logs/Output:
2023-05-02 10:49:04 +02:00
```
2023-05-09 17:04:02 +02:00
docker compose logs -f
2023-05-02 10:49:04 +02:00
```
2023-05-09 17:04:02 +02:00
dabo-bot.sh is the bot that trades and collects the quotes and analyze.sh is the tool with which you can try out strategies with the historical data.
The configuration files are called dabo-bot.conf and analyze.conf. analyze.sh also uses bot.conf but its variables are overwritten by analyze.conf if duplicated.
2023-04-28 17:07:43 +02:00
2023-04-28 17:24:32 +02:00
A Binance or Bitpanda account must exist and the API must be enabled.
2023-04-28 17:07:43 +02:00
The access data is stored in the file .binance-secrets in the project directory in the variables API_SECRET and API_KEY.
The access rights to this file should be set to the minimum necessary for security reasons.
# Future ideas/featrues
- Crypto preferences (While/Blacklist for certain currencies)
- Overview trades/profits/losses for tax declaration
- Support for decentralized exchanges like uniswap to gain more "security"
2023-05-09 17:04:02 +02:00
- updatemanagement - immuteable .config
- archive old or large csv files