more pure bash to speed up things

This commit is contained in:
olli 2023-11-23 10:20:27 +01:00
parent cffe692e6c
commit 2a0fca0541

View File

@ -1,5 +1,7 @@
function get_vars_from_csv { function get_vars_from_csv {
set -x
f_ASSET_HIST_FILE="$1" f_ASSET_HIST_FILE="$1"
if ! [ -s "${f_ASSET_HIST_FILE}" ] if ! [ -s "${f_ASSET_HIST_FILE}" ]
then then
@ -13,13 +15,11 @@ function get_vars_from_csv {
fi fi
f_all_vars="f_market_performance=${f_market_performance}" f_all_vars="f_market_performance=${f_market_performance}"
set -x
# read last 4 lines in array if not given # read last 4 lines in array if not given
if [ -z "${f_last_lines_array}" ] if [ -z "${f_last_lines_array}" ]
then then
mapfile -t f_last_lines_array < <(tail -n4 "${f_ASSET_HIST_FILE}") mapfile -t f_last_lines_array < <(tail -n4 "${f_ASSET_HIST_FILE}")
fi fi
set +x
# if there are not four lines # if there are not four lines
if [ -z "${f_last_lines_array[3]}" ] if [ -z "${f_last_lines_array[3]}" ]
@ -126,6 +126,8 @@ f_macd_histogram_signal=${f_macd_histogram_signal}"
# Coingecko price # Coingecko price
get_var_from_line coingecko_price 40 get_var_from_line coingecko_price 40
set +x
} }
function get_var_from_line { function get_var_from_line {