X-Git-Url: http://git.treefish.org/~alex/bitvalue.git/blobdiff_plain/a78f46a80b4c2f94f7bbaa6f4cd3e3d262ef1766..6b2d0110e6698d9957179a4e985d9f0a26ed0792:/bitvalue?ds=inline diff --git a/bitvalue b/bitvalue index 4445017..1c08081 100755 --- a/bitvalue +++ b/bitvalue @@ -35,16 +35,22 @@ if [ ! -f $CONFIG ]; then cat << EOF > $CONFIG EXCHANGE="bitstamp" CURRENCY="EUR" -ZERO_RATE="1" -ZERO_VALUE="1" +BTC="1" EOF echo "Created config: $CONFIG - Adapt config parameters!" fi source $CONFIG -if ! ping -c 1 $HOST >/dev/null 2>&1; then - echo "Host $HOST is unreachable!" +URL="https://$HOST/export_data.csv?\ +currency=$CURRENCY&\ +data_type=price&\ +exchange=$EXCHANGE&\ +t=l&\ +timespan=$TIMESPAN" + +if ! wget -S --spider $URL 2>&1 | grep 'HTTP/1.1 200 OK' >/dev/null; then + echo "Can not retrieve data from $HOST!"; exit 1 fi @@ -53,9 +59,8 @@ set terminal dumb set datafile separator "," set xdata time set timefmt "%Y-%m-%d %H:%M:%S UTC" -set title "EXCHANGE: $EXCHANGE | TIMESPAN: $TIMESPAN\nZERO RATE: $ZERO_RATE $CURRENCY | ZERO VALUE: $ZERO_VALUE $CURRENCY" -plot "< wget -q -O - \"https://$HOST/export_data.csv?currency=$CURRENCY&data_type=price&exchange=$EXCHANGE&t=l×pan=$TIMESPAN\"" \ - using 1:(\$3/$ZERO_RATE*$ZERO_VALUE) with lines title "" +set title "EXCHANGE: $EXCHANGE | TIMESPAN: $TIMESPAN\nCURRENCY: $CURRENCY | BTC: $BTC " +plot "< wget -q -O - \"$URL\"" using 1:(\$3*$BTC) with lines title "" EOF if [ $? -ne 0 ]; then