fix valid number check
This commit is contained in:
parent
d338afc2e5
commit
31d91da5b4
@ -50,7 +50,6 @@ function get_marketdata_from_url {
|
|||||||
|
|
||||||
# check source platform for parsing parameters, prepare and run wget command
|
# check source platform for parsing parameters, prepare and run wget command
|
||||||
>MARKET_DATA_CMD
|
>MARKET_DATA_CMD
|
||||||
echo ${f_url} | grep -q "finance.yahoo.com" &&
|
|
||||||
echo ${f_url} | grep -q "boerse.de" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | sed s'#\"#\n#g' | egrep '^[0-9]+\.[0-9]+'" >MARKET_DATA_CMD
|
echo ${f_url} | grep -q "boerse.de" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | sed s'#\"#\n#g' | egrep '^[0-9]+\.[0-9]+'" >MARKET_DATA_CMD
|
||||||
echo ${f_url} | egrep -q "investing.com.+economic-calendar" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'Actual.+Forecast.+Previous' | cut -d'>' -f7,11 | cut -d'<' -f1,2 | sed 's#,##g' | sed 's/\%//g' | sed 's#</div>#,#' | grep '[0-9]'" >MARKET_DATA_CMD
|
echo ${f_url} | egrep -q "investing.com.+economic-calendar" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'Actual.+Forecast.+Previous' | cut -d'>' -f7,11 | cut -d'<' -f1,2 | sed 's#,##g' | sed 's/\%//g' | sed 's#</div>#,#' | grep '[0-9]'" >MARKET_DATA_CMD
|
||||||
echo ${f_url} | egrep -q "investing.com.+indices" && echo "wget ${g_wget_opts} -q -O - ${f_url} | sed 's#</div>#\n#g' | grep 'text-5xl.*font-bold.*md:text-' | sed 's#^.*>##; s#,##g' | grep '[0-9]'" >MARKET_DATA_CMD
|
echo ${f_url} | egrep -q "investing.com.+indices" && echo "wget ${g_wget_opts} -q -O - ${f_url} | sed 's#</div>#\n#g' | grep 'text-5xl.*font-bold.*md:text-' | sed 's#^.*>##; s#,##g' | grep '[0-9]'" >MARKET_DATA_CMD
|
||||||
@ -60,23 +59,24 @@ function get_marketdata_from_url {
|
|||||||
g_runcmd g_retrycmd sh MARKET_DATA_CMD >MARKET_DATA_CMD_OUT-${f_name}.tmp 2>MARKET_DATA_CMD_OUT-${f_name}.tmp.err
|
g_runcmd g_retrycmd sh MARKET_DATA_CMD >MARKET_DATA_CMD_OUT-${f_name}.tmp 2>MARKET_DATA_CMD_OUT-${f_name}.tmp.err
|
||||||
|
|
||||||
# check output
|
# check output
|
||||||
if [ -s MARKET_DATA_CMD_OUT-${f_name}.tmp ] && egrep -q "^[0-9]*\.[0-9]+" MARKET_DATA_CMD_OUT-${f_name}.tmp
|
local f_get_marketdata_price_tmp=$(cat MARKET_DATA_CMD_OUT-${f_name}.tmp)
|
||||||
|
if g_num_valid_number ${f_get_marketdata_price_tmp}
|
||||||
then
|
then
|
||||||
if egrep -q "^0\.00" MARKET_DATA_CMD_OUT-${f_name}.tmp
|
if egrep -q "^0\.00" MARKET_DATA_CMD_OUT-${f_name}.tmp
|
||||||
then
|
then
|
||||||
g_echo_note "Ignoring ${f_name} $(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp) - maybe out of business day"
|
g_echo_note "Ignoring ${f_name} $(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp) - maybe out of business day"
|
||||||
else
|
else
|
||||||
g_echo_note "${f_name}: $(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp)"
|
g_echo_note "${f_name}: ${f_get_marketdata_price_tmp}"
|
||||||
mv MARKET_DATA_CMD_OUT-${f_name}.tmp MARKET_DATA_CMD_OUT-${f_name}
|
mv MARKET_DATA_CMD_OUT-${f_name}.tmp MARKET_DATA_CMD_OUT-${f_name}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
g_echo_warn "MARKET_DATA_CMD_OUT-${f_name}.tmp has wrong Syntax. - Not updating ${f_name} Index.
|
g_echo_warn "MARKET_DATA_CMD_OUT-${f_name}.tmp has wrong Syntax. - Not updating ${f_name} Index.
|
||||||
|
|
||||||
CMD:
|
CMD:
|
||||||
$(tail -n 10 MARKET_DATA_CMD);
|
$(tail -n 10 MARKET_DATA_CMD)
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
$(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp | cat -t);
|
$(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp | cat -t)
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
$(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp.err | cat -t)"
|
$(tail -n 10 MARKET_DATA_CMD_OUT-${f_name}.tmp.err | cat -t)"
|
||||||
|
Loading…
Reference in New Issue
Block a user