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