compare Trading and Convert price and use the cheaper variant - nicer output

This commit is contained in:
olli 2023-06-24 14:36:03 +02:00
parent f9000a3606
commit ec3376f670

View File

@ -27,7 +27,7 @@ function binance_convert {
# get trade commission for comparison with convert
binance-api-call GET /sapi/v1/asset/tradeFee "&symbol=${f_ASSET}${f_CURRENCY}"
local FEE=$(echo "$(cat $g_tmp/API_CMD_OUT | jq -r .[].takerCommission)*100" | bc -l)
local FEE=$(echo "$(cat $g_tmp/API_CMD_OUT | jq -r .[].takerCommission)*100" | bc -l | sed 's/^\./0./; s/^-\./-0./')
if [ "${f_ACTION}" = "buy" ]
then
@ -64,7 +64,7 @@ ${FUNCNAME} $@"
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"
local f_note="Price difference between Market Price (${f_market_price} ${f_CURRENCY}) and Binance Convert Price (${f_convert_price} ${f_CURRENCY}) is higher then Trading Fee (${f_price_diff}% > ${FEE}%), so I will better use trade then convert"
g_echo_note "$f_note"
g_signal-notify "$f_note"
return 1