fix market

This commit is contained in:
olli 2024-11-28 00:24:53 +01:00
parent e1a4bb4a46
commit 544fdb2a7a

View File

@ -146,11 +146,15 @@ function order {
# calculate price amount precision # calculate price amount precision
f_ccxt "print($STOCK_EXCHANGE.amountToPrecision('${f_symbol}', ${f_amount}))" f_ccxt "print($STOCK_EXCHANGE.amountToPrecision('${f_symbol}', ${f_amount}))"
f_amount=$f_ccxt_result f_amount=$f_ccxt_result
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_price}))" if [[ $f_type = limit ]]
f_price=$f_ccxt_result then
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_price}))"
f_price=$f_ccxt_result
fi
# do the order # 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" echo "$f_order" | notify.sh -s "ORDER"
f_ccxt "print($STOCK_EXCHANGE.createOrder(${f_order}))" || return 1 f_ccxt "print($STOCK_EXCHANGE.createOrder(${f_order}))" || return 1