less verbose; fix timeframes

This commit is contained in:
olli 2024-10-17 17:01:50 +02:00
parent 26cc075984
commit 5338017760

View File

@ -66,10 +66,9 @@ function currency_converter {
find . -name "*${f_stablecoin}.history.*.csv" | while read f_file find . -name "*${f_stablecoin}.history.*.csv" | while read f_file
do do
f_link_file=${f_file/${f_stablecoin}/USD} f_link_file=${f_file/${f_stablecoin}/USD}
#echo "Linkfile $f_link_file"
ln -sf "$f_file" "$f_link_file" ln -sf "$f_file" "$f_link_file"
done done
cd - cd - >/dev/null
# use USD # use USD
if [[ $f_currency_target = $f_stablecoin ]] if [[ $f_currency_target = $f_stablecoin ]]
then then
@ -98,17 +97,12 @@ function currency_converter {
local f_histfile_coinmarketcap_reverse="${f_asset_histories}${f_currency}${f_currency_target}.history" local f_histfile_coinmarketcap_reverse="${f_asset_histories}${f_currency}${f_currency_target}.history"
# search for rate by date # 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" for f_histfile in "$f_histfile_default" "$f_histfile_default_reverse" "$f_histfile_coinmarketcap" "$f_histfile_coinmarketcap_reverse"
do do
# search for most precise date # search for most precise date
f_line=$(egrep "^$f_currency_date_minute" "$f_histfile"*m.csv 2>/dev/null | tail -n1) 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_hour" "$f_histfile"*m.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_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) [ -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) [ -n "$f_line" ] && f_rate=$(echo "$f_line" | cut -d, -f2)
f_reverse=false f_reverse=false