Each red arrow represent a buying step.
The idea of this this algorithm is to smooth the entrance fee. It will buy all the new lows by weighting them.
For example :
The first buy will cost 10$. The second will cost 11$. The goal to increment the amount to invest is to attrack the price down to the bottom.
It buy only the lower price, if the price increases, we will count each candle between the last low and the new low and we make the sum of it.
For example, if at each candle it increments to 1$ and it starts to 10$ :
- price : 9, 8, 13, 10, 9,
7
- invest : 10, 11, 0(12), 0(13), 0(14),
12+13+14+15
=> when the price is 7$, it invests 54$ (12+13+14+15).
make install
make tests
make run
make generate-configuration
- price_initialisation: the price/amount of the first investment
- step_price: the price increase each iteration. For example, for the third iteration, price_initialisation + 3 - 1 * step_price will be invested.
- traded_pair : the pair to trade (ETHEUR, BTCEUR, XBTUSDC)
- force_buy_under_price (optional): under this price each iteration is bought
- max_amount_to_spend (optional): the maximum amount to spend each iteration
- max_total_amount_to_spend (optional): the total maximum to spend
json dca configuration:
{
"price_initialisation": 10,
"step_price": 1,
"traded_pair": "XBTEUR",
"force_buy_under_price": 20,
"max_amount_to_spend": 10000,
"max_total_amount_to_spend": 1000
}
Add a kraken.key file with the first line the key, and the second line the secret key.
Add a telegram.key file with the first line the chat_id, and the second line the secret key.
Clear db if it is the first run
-
Run iteration manually
make run-production
-
Scheduling execution with cron task
Add all this lines after crontab -e
-
“At 00:00 on Monday.” for the first line and “At 00:02 on Monday.” for the second and last lines
0 0 * * 1 cd /home/pi/Documents/dca/ && make run-production >> log.txt 2>&1 2 0 * * 1 cd /home/pi/Documents/dca/ && make backup-db >> log.txt 2>&1 2 0 * * 1 cd /home/pi/Documents/dca/ && make copy-data-to-front >> log.txt 2>&1 45 21 * * 0 cd /home/pi/Documents/dca/ && make pulse >> log.txt 2>&1
Copy the backups files in front > chart > data and add json extension to the files.
make run-front
make projection
-
backups are generated in backup directory.