4 HOST=data.bitcoinity.org
8 USAGE="Usage: $(basename "$0") [-h] [-t val]
9 Simple bash script to visualize the value of your bitcoin investment.
12 -h show this help text
13 -t set the timespan (default: $TIMESPAN)"
15 while getopts ':ht:' option; do
22 :) printf "missing argument for -%s\n" "$OPTARG" >&2
26 \?) printf "illegal option: -%s\n" "$OPTARG" >&2
34 if [ ! -f $CONFIG ]; then
41 echo "Created config: $CONFIG - Adapt config parameters!"
46 if ! ping -c 1 $HOST >/dev/null 2>&1; then
47 echo "Host $HOST is unreachable!"
51 cat << EOF | gnuplot 2>/dev/null
53 set datafile separator ","
55 set timefmt "%Y-%m-%d %H:%M:%S UTC"
56 set title "EXCHANGE: $EXCHANGE | TIMESPAN: $TIMESPAN\nZERO RATE: $ZERO_RATE $CURRENCY | ZERO VALUE: $ZERO_VALUE $CURRENCY"
57 plot "< wget -q -O - \"https://$HOST/export_data.csv?currency=$CURRENCY&data_type=price&exchange=$EXCHANGE&t=l×pan=$TIMESPAN\"" \
58 using 1:(\$3/$ZERO_RATE*$ZERO_VALUE) with lines title ""
62 echo "Error while preparing data!" >&2