Configuration

Bitcoin DCA uses environment variables to configure the inner workings of the tool. An environment variable looks like this: SOME_CONFIGURATION_KEY=valuehere.

Getting Started Template

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
##################################################################################
# GENERIC APPLICATION SETTINGS
##################################################################################

# You can either use this or WITHDRAW_XPUB. Choosing this one will make the tool withdraw to the same Bitcoin address
# every time.
WITHDRAW_ADDRESS=

# You can either use this or WITHDRAW_ADDRESS. Choosing this one will make the tool withdraw to a new receiving address
# every time a withdrawal is being made by the tool. It’ll start at the first address at index 0, so make sure to
# generate a new account or key when using this method.
# WITHDRAW_XPUB=

# Choose the cryptocurrency exchange this Bitcoin DCA tool will operate on. The default value is "bl3p".
# Available options: bl3p, bitvavo, kraken, binance
EXCHANGE=bl3p

# This setting is for the base currency you're buying with. Options are:
# BL3P:     EUR
# Bitvavo:  EUR
# Kraken:   USD EUR CAD JPY GBP CHF AUD
# Binance:  USDT BUSD EUR USDC USDT GBP AUD TRY BRL DAI TUSD RUB UAH PAX BIDR NGN IDRT VAI
BASE_CURRENCY=EUR

# If you want to receive an email when buys or withdrawals are made, activate this setting. The example here is for the Sendgrid API
# Available providers: https://bitcoin-dca.readthedocs.io/en/latest/getting-notified.html#sending-email-from-bitcoin-dca
# NOTIFICATION_EMAIL_ENABLED=1
# NOTIFICATION_EMAIL_DSN=sendgrid+api://APIKEYHERE@default
# NOTIFICATION_EMAIL_TO=you@gmail.com
# Optionally you can also configure these extra settings:
# NOTIFICATION_EMAIL_FROM=you@gmail.com
# NOTIFICATION_EMAIL_PREFIX="Bitcoin DCA"

# Bitcoin DCA can notify you on Telegram when purchases or withdrawals are made. You will need to
# contact Botfather to create a token: https://t.me/botfather
# To find out your Telegram ID you can talk to https://t.me/getmyid_bot
# NOTIFICATION_TELEGRAM_ENABLED=1
# NOTIFICATION_TELEGRAM_DSN=telegram://BOTFATHERSECRET@default?channel=YOURTELEGRAMID

# Bitcoin DCA will contact GitHub every time it is executed to let you know if there is a newer version available.
# Newer versions bring important security updates and new features. It transmits no information about your local environment.
# You can audit the code here: https://github.com/Jorijn/bitcoin-dca/blob/master/src/EventListener/CheckForUpdatesListener.php
# You can completely disable remote version checking by uncommenting this setting:
# DISABLE_VERSION_CHECK=1

##################################################################################
# BL3P exchange settings
##################################################################################

# This is the identifying part of the API key that you created on the BL3P exchange. You can find it there under the
# name Identifier Key.
BL3P_PUBLIC_KEY=

# This is the private part of your API connection to BL3P. It’s an encoded secret granting access to your BL3P account.
BL3P_PRIVATE_KEY=

##################################################################################
# Bitvavo exchange settings
# > no trading fees up to the first € 1000,- if you use my affiliate link: https://bitvavo.com/?a=DE4151B112
##################################################################################

# This is the identifying part of the API key that you created on the Bitvavo exchange.
# BITVAVO_API_KEY=

# This is the private part of your API connection to Bitvavo. It’s an encoded secret granting access to your Bitvavo account.
# BITVAVO_API_SECRET=


##################################################################################
# Kraken exchange settings
##################################################################################

# This is the identifying part of the API key that you created on the Kraken exchange.
# KRAKEN_API_KEY=

# This is the private part of your API connection to Kraken. It’s an encoded secret granting access to your Kraken account.
# KRAKEN_PRIVATE_KEY=

# Kraken secured the platform by limiting API usage to pre-whitelisted withdrawal addresses.
# This makes it a lot more secure but unfortunately limits the tool to one withdrawal address
# thus disabling XPUB generation. On Kraken, go to Funding and create a new Bitcoin withdrawal
# address and for description use something without special symbols or spaces. Configure the
# value here.
#
# [!] This option overrides any configured withdrawal address
# KRAKEN_WITHDRAW_DESCRIPTION=bitcoin-dca

# When you request to buy 100 EUR/USD from Kraken they assume you want to buy a minimum of 100
# by default. If the fee would be 0.30 that would be added to the 100, resulting in 100.30 being
# deducted from your EUR/USD balance. If you're transferring a fixed amount of money for a fixed
# amount of DCA cycles this would result in a lack of balance for the final complete DCA purchase
# of that cycle.
#
# include (default): deducts the fee estimation from your order, this will ensure you have enough
#                    balance left for the final DCA cycle.
# exclude:           Kraken default, the tool will order for 100 and Kraken will pay the fee with
#                    the remainder of your balance.
# KRAKEN_FEE_STRATEGY=include
#
# ONLY FOR GERMAN RESIDENTS:
# If your Kraken account is verified with a German address, you will need to accept a trading agreement
# in order to place market and margin orders.
#
# See https://support.kraken.com/hc/en-us/articles/360036157952
#
# KRAKEN_TRADING_AGREEMENT=agree

##################################################################################
# Binance exchange settings
##################################################################################

# This is the identifying part of the API key that you created on the Binance exchange.
# BINANCE_API_KEY=

# This is the private part of your API connection to Binance. It’s a secret granting access to your Binance account.
# BINANCE_API_SECRET=

Available Configuration

This part of the documentation is split up in generic application settings that decide how the tool should act for Dollar Cost Averaging. The last part is for exchange specific configuration like API keys.

Application Settings

WITHDRAW_ADDRESS

You can either use this or WITHDRAW_XPUB. Choosing this one will make the tool withdraw to the same Bitcoin address every time.

Example: WITHDRAW_ADDRESS=3AT3tf4cVfGRaQ87HpGQppTYmMrb5kpGQb

WITHDRAW_XPUB

You can either use this or WITHDRAW_ADDRESS. Choosing this one will make the tool withdraw to a new receiving address every time a withdrawal is being made by the tool. It’ll start at the first address at index 0, so make sure to generate a new account or key when using this method.

Example: WITHDRAW_XPUB=ypub6Y4RxNmNrdnwdwxERYnXa9rGd4upqeeJ3ixkJQUCQL8UcwYtXj86eXS5fVGU5xsmuuwRp3pKcdci89yiCmA9t2Mhi8cyEDD5P6w2NbfmWqT

EXCHANGE

This configuration value determines which exchange will be used for buys and withdrawals. The default value is BL3P.

Available options: bl3p, bitvavo, kraken, binance

Example: EXCHANGE=bl3p

DISABLE_VERSION_CHECK

Bitcoin DCA will contact GitHub every time it is executed to let you know if there is a newer version available. Newer versions bring important security updates and new features. It transmits no information about your local environment. You can audit the code here. You can completely disable remote version checking by uncommenting this setting:

Example: DISABLE_VERSION_CHECK=1

Email & Telegram notifications

To provide in-depth information about sending notifications through email and telegram, please see this article.

Exchange: BL3P

BL3P_PUBLIC_KEY

This is the identifying part of the API key that you created on the BL3P exchange. You can find it there under the name Identifier Key.

Example: BL3P_PUBLIC_KEY=0a12345b-01a1-1a1a-012a-a1bc23ef45bg

BL3P_PRIVATE_KEY

This is the private part of your API connection to BL3P. It’s an encoded secret granting access to your BL3P account.

Example: BL3P_PRIVATE_KEY=aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==

BL3P_API_URL (optional)

The endpoint where the tool should connect to.

Example: BL3P_API_URL=https://api.bl3p.eu/1/

Exchange: Bitvavo

BITVAVO_API_KEY

This is the identifying part of the API key that you created on the Bitvavo exchange.

Example: BITVAVO_API_KEY=1006e89gd84e8f3a5209b2762d1bbef36eds5e6108e7696f6117556830b0e3dy

BITVAVO_API_SECRET

This is the private part of your API connection to Bitvavo.

Example: BITVAVO_API_SECRET=aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==

BITVAVO_API_URL (optional)

The endpoint where the tool should connect to.

Example: BITVAVO_API_URL=https://api.bitvavo.com/v2/

Exchange: Kraken

KRAKEN_API_KEY

This is the identifying part of the API key that you created on the Kraken exchange.

Example: KRAKEN_API_KEY=1006e89gd84e8f3a5209b2762d1bbef36eds5e6108e7696f6117556830b0e3dy

KRAKEN_PRIVATE_KEY

This is the private part of your API connection to Kraken. It’s an encoded secret granting access to your Kraken account.

Example: KRAKEN_PRIVATE_KEY=aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==

KRAKEN_WITHDRAW_DESCRIPTION

Kraken secured the platform by limiting API usage to pre-whitelisted withdrawal addresses. This makes it a lot more secure but unfortunately limits the tool to one withdrawal address thus disabling XPUB generation. On Kraken, go to Funding and create a new Bitcoin withdrawal address and for description use something without special symbols or spaces. Configure the value here.

Example: KRAKEN_WITHDRAW_DESCRIPTION=bitcoin-dca

KRAKEN_API_URL (optional)

The endpoint where the tool should connect to.

Default: KRAKEN_API_URL=https://api.kraken.com/

KRAKEN_FEE_STRATEGY (optional)

When you request to buy 100 EUR/USD from Kraken they assume you want to buy a minimum of 100 by default. If the fee would be 0.30 that would be added to the 100, resulting in 100.30 being deducted from your EUR/USD balance. If you’re transferring a fixed amount of money for a fixed amount of DCA cycles this would result in a lack of balance for the final complete DCA purchase of that cycle.

Option include (default): deducts the fee estimation from your order, this will ensure you have enough balance left for the final DCA cycle. Option exclude: Kraken default, the tool will order for 100 and Kraken will pay the fee with the remainder of your balance.

Default: KRAKEN_FEE_STRATEGY=include

KRAKEN_TRADING_AGREEMENT (only for German residents)

If your Kraken account is verified with a German address, you will need to accept a trading agreement in order to place market and margin orders.

See https://support.kraken.com/hc/en-us/articles/360036157952

If you agree, fill this value with agree, like this: KRAKEN_TRADING_AGREEMENT=agree

Exchange: Binance

Your Binance API key should hold at least the following permissions:

  • Enable Reading
  • Enable Spot & Margin Trading
  • Enable Withdrawals

You should enable IP access restrictions to use withdrawal through the API. Enter the IP address that matches your outgoing connection. When in doubt, you can check your IP here: https://nordvpn.com/nl/ip-lookup/

BINANCE_API_KEY

This is the identifying part of the API key that you created on the Binance exchange.

Example: BINANCE_API_KEY=mkYEtmPzI9q9qrwvYzTe44nB495joEM17bhUDspFEkKHjzLmKwT1exvQYxGcL6db

BINANCE_API_SECRET

This is the private part of your API connection to Binance. It’s a secret granting access to your Binance account.

Example: BINANCE_API_SECRET=xXFw9vEiSdgllWfLs55uGC3ZBS3VyZMy1aGj4mYYlIIhX6hQ98AsGsQHLSKI4uj6

BINANCE_API_URL (optional)

The endpoint where the tool should connect to.

Default: BINANCE_API_URL=https://api.binance.com/

Feeding configuration into the DCA tool

Using a configuration file

When handling multiple environment variables, things can get messy. For easier management you can create a simple configuration file somewhere on your disk and use that to provide the tool with the correct configuration.

For example, creating a new configuration file in your home directory: nano /home/username/.bitcoin-dca

Note

You can find out where your home directory is using $ echo $HOME.

/home/username/.bitcoin-dca
BL3P_PUBLIC_KEY=....
BL3P_PRIVATE_KEY=....
WITHDRAW_ADDRESS=....

Now, when running the tool you can use --env-file like this:

Providing configuration with Docker’s –env-file
$ docker run --rm -it --env-file=/home/username/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest balance

Using inline arguments

For maximum control, you can also feed configuration into the tool like this:

Note

While this gives you more control, it will also allow other people who have access your machine to see the arguments with which you’ve started the Docker container, thus revealing your API keys.

Providing configuration by specifying each configuration item separately
$ docker run --rm -it -e BL3P_PUBLIC_KEY=abcd -e BL3P_PRIVATE_KEY=abcd WITHDRAW_ADDRESS=abcd ghcr.io/jorijn/bitcoin-dca:latest balance