From 53380177602b9d85409798306d03145e86b77dc5 Mon Sep 17 00:00:00 2001 From: olli Date: Thu, 17 Oct 2024 17:01:50 +0200 Subject: [PATCH] less verbose; fix timeframes --- dabo/functions/currency_converter.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dabo/functions/currency_converter.sh b/dabo/functions/currency_converter.sh index ce34063..b5362a7 100644 --- a/dabo/functions/currency_converter.sh +++ b/dabo/functions/currency_converter.sh @@ -66,10 +66,9 @@ function currency_converter { find . -name "*${f_stablecoin}.history.*.csv" | while read f_file do f_link_file=${f_file/${f_stablecoin}/USD} - #echo "Linkfile $f_link_file" ln -sf "$f_file" "$f_link_file" done - cd - + cd - >/dev/null # use USD if [[ $f_currency_target = $f_stablecoin ]] then @@ -98,17 +97,12 @@ function currency_converter { local f_histfile_coinmarketcap_reverse="${f_asset_histories}${f_currency}${f_currency_target}.history" # search for rate by date - echo "$f_histfile_default" "$f_histfile_default_reverse" "$f_histfile_coinmarketcap" "$f_histfile_coinmarketcap_reverse" - - echo "$f_currency_date_minute $f_currency_date_hour $f_currency_date_day $f_currency_date_month" - - for f_histfile in "$f_histfile_default" "$f_histfile_default_reverse" "$f_histfile_coinmarketcap" "$f_histfile_coinmarketcap_reverse" do # search for most precise date f_line=$(egrep "^$f_currency_date_minute" "$f_histfile"*m.csv 2>/dev/null | tail -n1) - [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_hour" "$f_histfile"*h.csv 2>/dev/null | tail -n1) - [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_day" "$f_histfile"*d.csv 2>/dev/null | tail -n1) + [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_hour" "$f_histfile"*m.csv 2>/dev/null | tail -n1) + [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_day" "$f_histfile"*h.csv 2>/dev/null | tail -n1) [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_month" "$f_histfile"*.csv 2>/dev/null | tail -n1) [ -n "$f_line" ] && f_rate=$(echo "$f_line" | cut -d, -f2) f_reverse=false