i am reviving signal to open order in this format : 'SELL', '1INCHUSDTPERP', '0.6396', '0.652392', '0.588432'. 1- side 2 - symbol 3 - order price 4 - stoploss price 5 - takeprofit price. Than i round all prices in this way:
tick = get_ticksize(symbol)
price = round_step_size(float(price), float(tick))
stopl = round_step_size(float(stopl), float(tick))
takep = round_step_size(float(takep), float(tick))
get_ticksize function:
def get_ticksize(symbol):
info = client.futures_exchange_info()
for item in info['symbols']:
if(item['symbol'] == symbol):
for f in item['filters']:
if f['filterType'] == 'PRICE_FILTER':
return f['tickSize']
And than i am opening orders:
stop = client.futures_create_order(symbol=symbol, side="SELL", type="STOP_MARKET", stopPrice=stopl, closePosition="true")
take = client.futures_create_order(symbol=symbol, side="SELL", type="TAKE_PROFIT_MARKET", stopPrice=takep, closePosition="true")
buyorder = client.futures_create_order(symbol=symbol, side=side, type="LIMIT", quantity=q, price=price, timeInForce="GTC")
so we have input
'SELL', '1INCHUSDTPERP', '0.6396', '0.652392', '0.588432'
and output
SELL 1INCHUSDT 0.6396 0.6523 0.5884
Stoploss and takeprofit opens without any problem but order not opening:
binance.exceptions.BinanceAPIException: APIError(code=-1111): Precision is over the maximum defined for this asset.