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 URL="http://$HOST/export_data.csv?\
52 if ! wget -S --spider $URL 2>&1 | grep 'HTTP/1.1 200 OK' >/dev/null; then
53 echo "Can not retrieve data from $HOST!";
57 cat << EOF | gnuplot 2>/dev/null
59 set datafile separator ","
61 set timefmt "%Y-%m-%d %H:%M:%S UTC"
62 set title "EXCHANGE: $EXCHANGE | TIMESPAN: $TIMESPAN\nCURRENCY: $CURRENCY | BTC: $BTC "
63 plot "< wget -q -O - \"$URL\"" using 1:(\$3*$BTC) with lines title ""
67 echo "Error while preparing data!" >&2