]> git.treefish.org Git - bitvalue.git/commitdiff
Initial commit
authorAlexander Schmidt <alex@treefish.org>
Tue, 7 Nov 2017 22:41:12 +0000 (23:41 +0100)
committerAlexander Schmidt <alex@treefish.org>
Tue, 7 Nov 2017 22:41:12 +0000 (23:41 +0100)
bitvalue [new file with mode: 0755]

diff --git a/bitvalue b/bitvalue
new file mode 100755 (executable)
index 0000000..f2bb53c
--- /dev/null
+++ b/bitvalue
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+CONFIG=~/.bitvaluerc
+
+if [ ! -f $CONFIG ]; then
+    cat << EOF > $CONFIG
+CURRENCY="EUR"
+ZERO_RATE="1"
+ZERO_VALUE="1"
+EOF
+    echo "Created config: $CONFIG - Adapt config parameters!"
+fi
+
+source $CONFIG
+
+if [ ! -z "$1" ]; then
+    TIMESPAN="$1"
+else
+    TIMESPAN="30d"
+fi
+
+cat << EOF | gnuplot
+set terminal dumb
+set datafile separator ","
+set xdata time
+set timefmt "%Y-%m-%d %H:%M:%S UTC"
+set title "TIMESPAN: $TIMESPAN | ZERO RATE: $ZERO_RATE $CURRENCY | ZERO VALUE: $ZERO_VALUE $CURRENCY"
+plot "< wget -q -O - \"https://data.bitcoinity.org/export_data.csv?currency=$CURRENCY&data_type=price&exchange=bitstamp&t=l&timespan=$TIMESPAN\"" \
+     using 1:(\$3/$ZERO_RATE*$ZERO_VALUE) with lines title ""
+EOF