From 9f9b236c61bd4df6f6a7816c0f4ceb083f645f07 Mon Sep 17 00:00:00 2001 From: olli Date: Fri, 23 Jun 2023 22:40:44 +0200 Subject: [PATCH] buy price fix --- dabo/functions/check_sell_conditions.sh | 2 +- dabo/functions/webpage.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dabo/functions/check_sell_conditions.sh b/dabo/functions/check_sell_conditions.sh index ba133f2..0d844b8 100644 --- a/dabo/functions/check_sell_conditions.sh +++ b/dabo/functions/check_sell_conditions.sh @@ -21,7 +21,7 @@ function check_sell_conditions { return 0 fi f_TRADE_HIST_FILE_INTERIM=$(echo ${f_TRADE_HIST_FILE} | sed 's/-open\.history\.csv$/-interim.history.csv/') - local f_BUY_PRICE=$(grep ',BUY' $f_TRADE_HIST_FILE | tail -n1 | cut -d, -f5) + local f_BUY_PRICE=$(grep -i ',BUY,' $f_TRADE_HIST_FILE | tail -n1 | cut -d, -f5) local f_BUY_PRICE_LAST_RATE_DIFF=$(g_percentage-diff ${f_BUY_PRICE} ${f_price}) # Store for overview echo ${f_BUY_PRICE_LAST_RATE_DIFF} >DIFF_BUY_PRICE_${f_ASSET} diff --git a/dabo/functions/webpage.sh b/dabo/functions/webpage.sh index 8392c5d..a325c2a 100644 --- a/dabo/functions/webpage.sh +++ b/dabo/functions/webpage.sh @@ -192,7 +192,7 @@ function webpage { # local f_trade_date=${trade[3]} # local f_trade_currency=${trade[1]} # local f_trade_sell_for=${trade[6]} -# local f_trade_buy_for=$(grep -B1 "^${f_trade_date},sell," "trade-histories/${f_trade_currency}.history.csv" | grep ",buy," | cut -d, -f4 | cut -d" " -f1) +# local f_trade_buy_for=$(grep -B1 "^${f_trade_date},sell," "trade-histories/${f_trade_currency}.history.csv" | grep -i ",buy," | cut -d, -f4 | cut -d" " -f1) # local f_result=$(echo "scale=2; ${f_trade_sell_for}-$f_trade_buy_for" | bc -l | sed 's/^\./0./; s/^-\./-0./' | xargs printf "%.2f") # local f_result_percentage=$(g_percentage-diff $f_trade_buy_for ${f_trade_sell_for}) # f_trace_price="$f_trace_price ($f_result( ${f_result_percentage}%))"