From 2a7ec12fff0e44fa3dedc23caa1f21f5adfffb49 Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 3 Jan 2024 16:01:02 +0100 Subject: [PATCH] get price from raw file if non-full-loop --- dabo/functions/get_vars_from_csv.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dabo/functions/get_vars_from_csv.sh b/dabo/functions/get_vars_from_csv.sh index 8feec90..75c2fde 100644 --- a/dabo/functions/get_vars_from_csv.sh +++ b/dabo/functions/get_vars_from_csv.sh @@ -39,6 +39,15 @@ function get_vars_from_csv { # basics get_var_from_line date 1 get_var_from_line price 2 + + # get newest price from raw file if this is a non-full loop + # TODO: Nicer pure-bash code + if [ ${FULL_LOOP} == 0 ] + then + f_ASSET_HIST_FILE_RAW=$(echo ${f_ASSET_HIST_FILE} | sed 's/.csv$/-raw.csv/') + f_price=$(tail -n1 "${f_ASSET_HIST_FILE_RAW}" | cut -d, -f2) + fi + get_var_from_line price_change 3 # Check for price trend last 4 iterations