]> git.treefish.org Git - bitvalue.git/blob - bitvalue
Initial commit
[bitvalue.git] / bitvalue
1 #!/bin/bash
2
3 CONFIG=~/.bitvaluerc
4
5 if [ ! -f $CONFIG ]; then
6     cat << EOF > $CONFIG
7 CURRENCY="EUR"
8 ZERO_RATE="1"
9 ZERO_VALUE="1"
10 EOF
11     echo "Created config: $CONFIG - Adapt config parameters!"
12 fi
13
14 source $CONFIG
15
16 if [ ! -z "$1" ]; then
17     TIMESPAN="$1"
18 else
19     TIMESPAN="30d"
20 fi
21
22 cat << EOF | gnuplot
23 set terminal dumb
24 set datafile separator ","
25 set xdata time
26 set timefmt "%Y-%m-%d %H:%M:%S UTC"
27 set title "TIMESPAN: $TIMESPAN | ZERO RATE: $ZERO_RATE $CURRENCY | ZERO VALUE: $ZERO_VALUE $CURRENCY"
28 plot "< wget -q -O - \"https://data.bitcoinity.org/export_data.csv?currency=$CURRENCY&data_type=price&exchange=bitstamp&t=l&timespan=$TIMESPAN\"" \
29      using 1:(\$3/$ZERO_RATE*$ZERO_VALUE) with lines title ""
30 EOF