add EGLD graphing and report

This commit is contained in:
Arne Baeumler 2021-02-08 20:17:44 +01:00
parent ba1113d21b
commit 2caf1747f6
4 changed files with 15 additions and 1 deletions

1
run.sh
View File

@ -1,6 +1,7 @@
#!/bin/sh
/var/www/mrtg/scripts/getCryptocurrencies.sh
/var/www/mrtg/scripts/getEGLD.sh
/var/www/mrtg/scripts/lxc_update.sh
MRTG="/usr/bin/mrtg"

View File

@ -11,3 +11,4 @@
2021-01-14;XTZ;22.784402;50;1.99;2.11;10
2021-01-14;XLM;380.6974577;100;2.99;0.2548;10
2021-01-14;ETH;0.48874273;500;7.34;1008.01;10
2021-02-03;EGLD;35.12583900;2000;6.00;56.8242654;50

1 2020-04-21 BTC 0.00289369 20 1.49 6396.68 40
11 2021-01-14 XTZ 22.784402 50 1.99 2.11 10
12 2021-01-14 XLM 380.6974577 100 2.99 0.2548 10
13 2021-01-14 ETH 0.48874273 500 7.34 1008.01 10
14 2021-02-03 EGLD 35.12583900 2000 6.00 56.8242654 50

View File

@ -36,7 +36,7 @@ sub getCurrentPrice {
sub getLastWeekValue {
my ($symbol) = @_;
my ($start,$step,$name,$data) = RRDs::fetch("${rrdpath}/crypto-${symbol}.rrd","AVERAGE","--start","-7d");
return($data->[0]->[0]);
return($data->[0]->[0] || 1);
}
open(CSV,"<$file") or die("open($file): $!\n");

12
scripts/getEGLD.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
RRDDIR="/var/www/localhost/rrd"
RRDPREFIX="crypto-"
TMPLDIR="/var/www/localhost/tmpl"
EGLDBTC=$(curl -s "https://api.binance.com/api/v3/ticker/price?symbol=EGLDBTC" | jq .price | sed 's/"//g')
BTCEUR=$(curl -s "https://api.binance.com/api/v3/ticker/price?symbol=BTCEUR" | jq .price | sed 's/"//g')
SELL=$(echo $EGLDBTC $BTCEUR | awk '{printf "%.8f",$1*$2}')
rrdtool update "${RRDDIR}/${RRDPREFIX}EGLD.rrd" N:${SELL}