From 544fdb2a7afc6c56ac0ecf69043e7708c640f9a6 Mon Sep 17 00:00:00 2001 From: olli Date: Thu, 28 Nov 2024 00:24:53 +0100 Subject: [PATCH] fix market --- dabo/functions/order.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dabo/functions/order.sh b/dabo/functions/order.sh index f42b2b1..d352874 100644 --- a/dabo/functions/order.sh +++ b/dabo/functions/order.sh @@ -146,11 +146,15 @@ function order { # calculate price amount precision f_ccxt "print($STOCK_EXCHANGE.amountToPrecision('${f_symbol}', ${f_amount}))" f_amount=$f_ccxt_result - f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_price}))" - f_price=$f_ccxt_result + if [[ $f_type = limit ]] + then + f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_price}))" + f_price=$f_ccxt_result + fi # do the order - local f_order="symbol='${f_symbol}', type='$f_type', price=$f_price, amount=${f_amount}, side='${f_side}', ${f_params}" + [[ $f_type = limit ]] && local f_order="symbol='${f_symbol}', type='$f_type', price=$f_price, amount=${f_amount}, side='${f_side}', ${f_params}" + [[ $f_type = market ]] && local f_order="symbol='${f_symbol}', type='$f_type', amount=${f_amount}, side='${f_side}', ${f_params}" echo "$f_order" | notify.sh -s "ORDER" f_ccxt "print($STOCK_EXCHANGE.createOrder(${f_order}))" || return 1