From 1dcd81f894d8c1a094bb14ea9f402a2cc11d0304 Mon Sep 17 00:00:00 2001 From: olli Date: Sat, 11 Nov 2023 17:09:52 +0100 Subject: [PATCH] more pure bash to speed up things --- dabo/functions/get_vars_from_csv.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dabo/functions/get_vars_from_csv.sh b/dabo/functions/get_vars_from_csv.sh index bc31eae..bec4a8f 100644 --- a/dabo/functions/get_vars_from_csv.sh +++ b/dabo/functions/get_vars_from_csv.sh @@ -9,7 +9,7 @@ function get_vars_from_csv { if [ -z "${f_last_lines}" ] then - mapfile -t f_last_lines <<< $(tail -n4 "${f_ASSET_HIST_FILE}") + # mapfile -t f_last_lines <<< $(tail -n4 "${f_ASSET_HIST_FILE}") fi if [ -z "${f_market_performance}" ] @@ -36,6 +36,9 @@ function get_vars_from_csv { #f_last_4_prices=$(tail -n4 "${f_ASSET_HIST_FILE}" | cut -d, -f2) #f_last_4_price=$(echo ${f_last_4_prices} | head -n1) #f_last_4_prices_change=$(g_percentage-diff ${f_last_4_price} ${f_price}) + + echo "g_percentage-diff ${f_4_last_line_array[2]} ${f_price}" 1>&2 + f_last_4_prices_change=$(g_percentage-diff ${f_4_last_line_array[2]} ${f_price}) # if printf '%s\n' ${f_last_4_prices} | sort -n -C @@ -54,7 +57,7 @@ function get_vars_from_csv { elif g_num_is_lower ${f_last_4_prices_change} 0 then f_price_trend="falling,${f_last_4_prices_change}" - if g_num_is_higher ${f_3_last_line_array[2]} ${f_4_last_line_array[2]} && g_num_is_higher ${f_2_last_line_array[2]} ${f_3_last_line_array[2]} && g_num_is_higher ${f_price} ${f_2_last_line_array[2]} + if g_num_is_lower ${f_3_last_line_array[2]} ${f_4_last_line_array[2]} && g_num_is_lower ${f_2_last_line_array[2]} ${f_3_last_line_array[2]} && g_num_is_lower ${f_price} ${f_2_last_line_array[2]} then f_price_trend="constantly falling,${f_last_4_prices_change}" fi