fix addes boerse.de oil/gas and s&p500 index

This commit is contained in:
olli 2023-10-02 17:56:19 +02:00
parent 00687e75f9
commit b23b09a35b
2 changed files with 59 additions and 17 deletions

View File

@ -95,23 +95,43 @@ function get_assets {
export csv_headline
. /tmp/parallel
# get MSCI World Index for analysis
echo "wget -q -O - https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >MSCI_WORLD_CMD
g_runcmd g_retrycmd sh MSCI_WORLD_CMD >MSCI_WORLD_CMD_OUT.tmp
# check output
if [ -s MSCI_WORLD_CMD_OUT.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" MSCI_WORLD_CMD_OUT.tmp
then
if egrep -q "^0\.00$" MSCI_WORLD_CMD_OUT.tmp
then
g_echo_note "Ignoring MSCI World $(tail -n 10 MSCI_WORLD_CMD_OUT.tmp) - maybe out of business day"
else
mv MSCI_WORLD_CMD_OUT.tmp MSCI_WORLD_CMD_OUT
fi
else
g_echo_warn "MSCI_WORLD_CMD_OUT.tmp has wrong Syntax. - Not updating MSCI WORLD Index $(tail -n 10 MSCI_WORLD_CMD_OUT.tmp)"
fi
echo "${f_timestamp},$(cat MSCI_WORLD_CMD_OUT)" >>asset-histories/MSCI-WORLD-INDEX.history.csv
## get MSCI World Index for analysis
#echo "wget -q -O - https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >MSCI_WORLD_CMD
#g_runcmd g_retrycmd sh MSCI_WORLD_CMD >MSCI_WORLD_CMD_OUT.tmp
## check output
#if [ -s MSCI_WORLD_CMD_OUT.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" MSCI_WORLD_CMD_OUT.tmp
#then
# if egrep -q "^0\.00$" MSCI_WORLD_CMD_OUT.tmp
# then
# g_echo_note "Ignoring MSCI World $(tail -n 10 MSCI_WORLD_CMD_OUT.tmp) - maybe out of business day"
# else
# mv MSCI_WORLD_CMD_OUT.tmp MSCI_WORLD_CMD_OUT
# fi
#else
# g_echo_warn "MSCI_WORLD_CMD_OUT.tmp has wrong Syntax. - Not updating MSCI WORLD Index $(tail -n 10 MSCI_WORLD_CMD_OUT.tmp)"
#fi
#echo "${f_timestamp},$(cat MSCI_WORLD_CMD_OUT)" >>asset-histories/MSCI-WORLD-INDEX.history.csv
#
# # get SundP500 Index for analysis
# echo "wget -q -O - https://www.boerse.de/indizes/SundP-500/US78378X1072 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >SP500_CMD
# g_runcmd g_retrycmd sh SP500_CMD >SP500_CMD_OUT.tmp
# # check output
# if [ -s SP500_CMD_OUT.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" SP500_CMD_OUT.tmp
# then
# if egrep -q "^0\.00$" SP500_CMD_OUT.tmp
# then
# g_echo_note "Ignoring SP500 $(tail -n 10 SP500_CMD_OUT.tmp) - maybe out of business day"
# else
# mv SP500_CMD_OUT.tmp SP500_CMD_OUT
# fi
# else
# g_echo_warn "SP500_CMD_OUT.tmp has wrong Syntax. - Not updating SP500 Index $(tail -n 10 SP500_CMD_OUT.tmp)"
# fi
# echo "${f_timestamp},$(cat SP500_CMD_OUT)" >>asset-histories/SP500-INDEX.history.csv
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
}

View File

@ -0,0 +1,22 @@
function get_boerse_de {
local f_url="$1"
local f_name="$2"
# get SundP500 Index 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
# check output
if [ -s BOERSE_DE_CMD_OUT.tmp ] && egrep -q "^[0-9]*\.[0-9]+$" BOERSE_DE_CMD_OUT.tmp
then
if egrep -q "^0\.00$" BOERSE_DE_CMD_OUT.tmp
then
g_echo_note "Ignoring ${f_name} $(tail -n 10 BOERSE_DE_CMD_OUT.tmp) - maybe out of business day"
else
mv BOERSE_DE_CMD_OUT.tmp BOERSE_DE_CMD_OUT
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)"
fi
echo "${f_timestamp},$(cat BOERSE_DE_CMD_OUT)" >>asset-histories/${f_name}.history.csv
}