price precision
This commit is contained in:
parent
fdc3013501
commit
5e07b0450b
@ -89,14 +89,29 @@ function order {
|
||||
fi
|
||||
|
||||
# Add stoploos and take profit if available
|
||||
[ -n "$f_stoploss" ] && f_params="${f_params}'stopLossPrice': '$f_stoploss', "
|
||||
[ -n "$f_takeprofit" ] && f_params="${f_params}'takeProfitPrice': '$f_takeprofit', "
|
||||
if [ -n "$f_stoploss" ]
|
||||
then
|
||||
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_stoploss}))"
|
||||
f_stoploss=$f_ccxt_result
|
||||
f_params="${f_params}'stopLossPrice': '$f_stoploss', "
|
||||
if [ -n "$f_takeprofit" ]
|
||||
then
|
||||
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_takeprofit}))"
|
||||
f_takeprofit=$f_ccxt_result
|
||||
f_params="${f_params}'takeProfitPrice': '$f_takeprofit', "
|
||||
fi
|
||||
|
||||
# end up params syntax with "}"
|
||||
f_params="${f_params}}"
|
||||
|
||||
# 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
|
||||
|
||||
# do the order
|
||||
local f_order="symbol='${f_symbol}', type='$f_type', price=$f_price, amount='${f_amount}', side='${f_side}', ${f_params}"
|
||||
local f_order="symbol='${f_symbol}', type='$f_type', price=$f_price, 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user