This script will invest, every day, a certain amount of money on the different currencies listed in a .json file. These investments can be currency weighted, and depend on the performance of the assets during the day (those that perform better will have a smaller investment, and vice versa). The script is very flexible according to your needs and will output daily records of your investment as a .csv file.
You have to modify the currencies.json
file depending on
the objectives of your investment.
Each asset should be in the following format:
"Asset name": {
"symbol": "ASSETSYMBOL",
"weight": X
},
Where:
"ASSETSYMBOL"
is the symbol that identifies the currency (e.g. BTC for Bitcoin).X
is a number in [0, 1], s.t. the sum of the weights in the file is equal to 1. It defines the proportion of the investment that you want to put in this currency.
The script is scheduled to run once a day, at a given hour. In order to perform its task, it must not be stopped once launched.
python src/dca.py $EXCHANGE $YOUR_API_KEY $YOUR_API_SECRET $DAILY_INVESTMENT $FIAT $FEES $HH
$EXCHANGE
defines the exchange used to perform the purchases (the list of the available exchanges is available on CCXT).$YOUR_API_KEY
and$YOUR_API_SECRET
can be obtained on the exchange and allow its API level access.$DAILY_INVESTMENT
defines your daily investment quantity (the unit being$FIAT
).$FIAT
defines the currency used to make the purchases.$FEES
corresponds to the amount deducted by the exchange on every transaction that you made (0 if unknown).$HH
defines the hour at which the script will perform the investment.
Example for crypto.com/exchange, with 0.4% fees, using 20 USDT/day, and buying every day at 12:00:
python src/dca.py cryptocom XXX ZZZ 20 USDT 0.004 12
In order to view the investments made by the script, you can use the following command to print the summed table:
python src/record.py
-
Icon made by Monkik - Flat Icons from www.flaticon.com