4 HOST=data.bitcoinity.org
8 USAGE="Usage: $(basename "$0") [-h] [-t 10m|1h|24h|3d|7d|30d|6m|2y|5y|all]
9 Simple bash script to visualize the value of your bitcoin investment.
12 -h show this help text
13 -t used 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
40 echo "Created config: $CONFIG - Adapt config parameters!"
45 if ! ping -c 1 $HOST >/dev/null 2>&1; then
46 echo "Host $HOST is unreachable!"
50 cat << EOF | gnuplot 2>/dev/null
52 set datafile separator ","
54 set timefmt "%Y-%m-%d %H:%M:%S UTC"
55 set title "EXCHANGE: $EXCHANGE | TIMESPAN: $TIMESPAN\nCURRENCY: $CURRENCY | BTC: $BTC "
56 plot "< wget -q -O - \"https://$HOST/export_data.csv?currency=$CURRENCY&data_type=price&exchange=$EXCHANGE&t=l×pan=$TIMESPAN\"" \
57 using 1:(\$3*$BTC) with lines title ""
61 echo "Error while preparing data!" >&2