more pure bash to speed up things

This commit is contained in:
olli 2023-11-11 17:09:52 +01:00
parent 921296f216
commit 1dcd81f894

View File

@ -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