more pure bash to speed up things

This commit is contained in:
olli 2023-11-11 17:22:30 +01:00
parent 04601ca607
commit da5639d9a3

View File

@ -7,13 +7,10 @@ function get_vars_from_csv {
return 1 return 1
fi fi
set -x if [ -z "${f_last_lines_array}" ]
then
mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}")
#if [ -z "${f_last_lines}" ] fi
#then
mapfile -t f_last_lines <<< $(tail -n4 "${f_ASSET_HIST_FILE}")
#fi
if [ -z "${f_market_performance}" ] if [ -z "${f_market_performance}" ]
then then
@ -22,13 +19,11 @@ set -x
f_all_vars="f_market_performance=${f_market_performance}" f_all_vars="f_market_performance=${f_market_performance}"
#f_last_line="$(tail -n1 "${f_ASSET_HIST_FILE}"),${f_market_performance}" #f_last_line="$(tail -n1 "${f_ASSET_HIST_FILE}"),${f_market_performance}"
f_last_line="${f_last_lines[3]}" f_last_line="${f_last_lines_array[3]}"
readarray -d "," -t f_last_line_array < <(echo "0,${f_last_line}") readarray -d "," -t f_last_line_array < <(echo "0,${f_last_line}")
readarray -d "," -t f_2_last_line_array < <(echo "0,${f_last_lines[2]}") readarray -d "," -t f_2_last_line_array < <(echo "0,${f_last_lines_array[2]}")
readarray -d "," -t f_3_last_line_array < <(echo "0,${f_last_lines[1]}") readarray -d "," -t f_3_last_line_array < <(echo "0,${f_last_lines_array[1]}")
readarray -d "," -t f_4_last_line_array < <(echo "0,${f_last_lines[0]}") readarray -d "," -t f_4_last_line_array < <(echo "0,${f_last_lines_array[0]}")
set +x
f_asset=$(basename ${f_ASSET_HIST_FILE} | cut -d\. -f1) f_asset=$(basename ${f_ASSET_HIST_FILE} | cut -d\. -f1)
@ -129,7 +124,7 @@ 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
unset f_last_lines unset f_last_lines_array
} }