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