From f9000a360638aca4f4982fd251ea370c54019d48 Mon Sep 17 00:00:00 2001 From: olli Date: Fri, 23 Jun 2023 22:58:05 +0200 Subject: [PATCH] compare Trading and Convert price and use the cheaper variant fix --- dabo/functions/binance_convert.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dabo/functions/binance_convert.sh b/dabo/functions/binance_convert.sh index 9013fce..7411f0e 100644 --- a/dabo/functions/binance_convert.sh +++ b/dabo/functions/binance_convert.sh @@ -49,6 +49,7 @@ ${FUNCNAME} $@" cat ${g_tmp}/API_CMD_OUT >${f_CMDFILE}_QUOTE_OUT # get convert price local f_convert_price=$(cat ${f_CMDFILE}_QUOTE_OUT | grep '^{' | jq -r .inverseRatio | head -n1) + local f_price_diff=$(g_percentage-diff ${f_market_price} ${f_convert_price}) fi if [ "${f_ACTION}" = "sell" ] @@ -58,9 +59,9 @@ ${FUNCNAME} $@" cat ${g_tmp}/API_CMD_OUT >${f_CMDFILE}_QUOTE_OUT # get convert price local f_convert_price=$(cat ${f_CMDFILE}_QUOTE_OUT | grep '^{' | jq -r .ratio | head -n1) + local f_price_diff=$(g_percentage-diff ${f_convert_price} ${f_market_price}) fi - local f_price_diff=$(g_percentage-diff ${f_market_price} ${f_convert_price}) if [ $(echo "${f_price_diff} > ${FEE}" | bc -l) -eq 1 ] then local f_note="Price difference between Market Price (${f_market_price}) and Binance Convert Price (${f_convert_price}) is higher then Trading Fee (${f_price_diff} > ${FEE}), so I will better use trade then convert"