Last active
April 15, 2023 19:27
-
-
Save mvanduijker/79b59ff2a1eb3a91e78ad59d4c8cd113 to your computer and use it in GitHub Desktop.
Dollar averaging buy 10 euro of bitcoin with kraken api and it's cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Install kraken cli (https://support.kraken.com/hc/en-us/articles/360025180232-Kraken-REST-API-command-line-client) and put this script in same path | |
# Make sure the following tools are installed: bc, jq | |
# To make a daily trade add this script in your cron | |
# Use offical pair, check them with ./krakenapi.py AssetPairs | jq | |
PAIR=XXBTZEUR | |
# Price to buy in your currency | |
BUY_PRICE=10 | |
CURRENT_PRICE=$(./krakenapi.py Ticker pair=$PAIR | jq .result.$PAIR.a[0] | bc -l) | |
VOLUME=$(echo "$BUY_PRICE / $CURRENT_PRICE" | bc -l) | |
./krakenapi.py AddOrder pair=$PAIR type=buy ordertype=market volume=$VOLUME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add
validate=true
to last command to dry run