fixes if boerse.de is down
This commit is contained in:
parent
b23b09a35b
commit
f6960ef9de
@ -132,6 +132,8 @@ function get_assets {
|
||||
get_boerse_de https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 MSCI-WORLD-INDEX
|
||||
get_boerse_de https://www.boerse.de/indizes/SundP-500/US78378X1072 SP500-INDEX
|
||||
get_boerse_de https://www.boerse.de/indizes/DJ-AMER-OIL-und-GAS/XC0006886516 OIL-GAS-INDEX
|
||||
get_boerse_de https://www.boerse.de/fonds/SPDR-SundP-Regional-Banking-ETF/US78464A6982 KRE-BANKING-INDEX
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,21 +2,23 @@ function get_boerse_de {
|
||||
local f_url="$1"
|
||||
local f_name="$2"
|
||||
|
||||
# get SundP500 Index for analysis
|
||||
# get data for analysis
|
||||
echo "wget -q -O - ${f_url} | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >BOERSE_DE_CMD
|
||||
g_runcmd g_retrycmd sh BOERSE_DE_CMD >BOERSE_DE_CMD_OUT.tmp
|
||||
g_runcmd g_retrycmd sh BOERSE_DE_CMD >BOERSE_DE_CMD_OUT-${f_name}.tmp
|
||||
# check output
|
||||
if [ -s BOERSE_DE_CMD_OUT.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" BOERSE_DE_CMD_OUT.tmp
|
||||
if [ -s BOERSE_DE_CMD_OUT-${f_name}.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" BOERSE_DE_CMD_OUT-${f_name}.tmp
|
||||
then
|
||||
if egrep -q "^0\.00$" BOERSE_DE_CMD_OUT.tmp
|
||||
if egrep -q "^0\.00$" BOERSE_DE_CMD_OUT-${f_name}.tmp
|
||||
then
|
||||
g_echo_note "Ignoring ${f_name} $(tail -n 10 BOERSE_DE_CMD_OUT.tmp) - maybe out of business day"
|
||||
g_echo_note "Ignoring ${f_name} $(tail -n 10 BOERSE_DE_CMD_OUT-${f_name}.tmp) - maybe out of business day"
|
||||
else
|
||||
mv BOERSE_DE_CMD_OUT.tmp BOERSE_DE_CMD_OUT
|
||||
g_echo_note "${f_name}: $(tail -n 10 BOERSE_DE_CMD_OUT-${f_name}.tmp)"
|
||||
mv BOERSE_DE_CMD_OUT-${f_name}.tmp BOERSE_DE_CMD_OUT-${f_name}
|
||||
fi
|
||||
else
|
||||
g_echo_warn "BOERSE_DE_CMD_OUT.tmp has wrong Syntax. - Not updating ${f_name} Index $(tail -n 10 BOERSE_DE_CMD_OUT.tmp)"
|
||||
g_echo_warn "BOERSE_DE_CMD_OUT-${f_name}.tmp has wrong Syntax. - Not updating ${f_name} Index $(tail -n 10 BOERSE_DE_CMD_OUT-${f_name}.tmp)"
|
||||
fi
|
||||
echo "${f_timestamp},$(cat BOERSE_DE_CMD_OUT)" >>asset-histories/${f_name}.history.csv
|
||||
[ -e "BOERSE_DE_CMD_OUT-${f_name}" ] || echo 0 >BOERSE_DE_CMD_OUT-${f_name}
|
||||
echo "${f_timestamp},$(cat BOERSE_DE_CMD_OUT-${f_name})" >>asset-histories/${f_name}.history.csv
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,12 @@ function market_performance {
|
||||
local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to})
|
||||
#local f_back=10080
|
||||
#get_rate_percentage_min_before_and_now MSCI-WORLD- INDEX $f_back || return 1
|
||||
local f_msci_world_performance=$(echo "scale=2; ${f_exchange_rate_diff_percentage}/2" | bc -l | sed -r 's/^(-?)\./\10./')
|
||||
if [ ${f_to} == "0" ] || [ ${f_from} == "0" ]
|
||||
then
|
||||
local f_msci_world_performance="-0.1"
|
||||
else
|
||||
local f_msci_world_performance=$(echo "scale=2; ${f_exchange_rate_diff_percentage}/2" | bc -l | sed -r 's/^(-?)\./\10./')
|
||||
fi
|
||||
|
||||
# price performance bitcoin (last 30 minutes)
|
||||
local f_from=$(tail -n 30 asset-histories/BTC${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2)
|
||||
|
Loading…
Reference in New Issue
Block a user