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