compare Trading and Convert price and use the cheaper variant fix

This commit is contained in:
olli 2023-06-23 22:58:05 +02:00
parent 9f9b236c61
commit f9000a3606

View File

@ -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"