Hey, I am unable to set up a scenario like you described, for my take profit/stoploss orders I keep receiving “-1106: Parameter ‘reduceOnly’ sent when not required.”
Settings I used for testing:
symbol = btcusdt
signal = Signal.BUY; (Buy market order with sell for stoploss/take profit)
quantity = 0.01
takeprofit = 59000
stoploss = 58000
I fetch their unique client order IDs from the result, instead of generating my own as it seemed easier.
I first create a market order, which works fine (the order appears on the testnet platform)
And then create the 2 stoploss/take profit orders (but both of them respond with the same error)
like this:
Order marketOrder = syncRequestClient.postOrder(
symbol,
side == Signal.SELL ? OrderSide.SELL : OrderSide.BUY,
side == Signal.SELL ? PositionSide.SHORT : PositionSide.LONG,
OrderType.MARKET,
null, //TimeInForce
quantity.toString(), //Quantity
null, //Price
null, //Reduce only
null, //NewClientOrderId
null, //Stop price
null, //workingType
NewOrderRespType.RESULT //NewOrderRespType
);
Order stopOrder = syncRequestClient.postOrder(
symbol,
side == Signal.SELL ? OrderSide.BUY : OrderSide.SELL,
side == Signal.SELL ? PositionSide.SHORT : PositionSide.LONG,
OrderType.LIMIT,
TimeInForce.GTC,
quantity.toString(),
stoploss.toString(),
"true", //Reduce only
null, //NewClientOrderId
null, //Stop price
null, //workingType
NewOrderRespType.RESULT //NewOrderRespType
);
Order profitOrder = syncRequestClient.postOrder(
symbol,
side == Signal.SELL ? OrderSide.BUY : OrderSide.SELL,
side == Signal.SELL ? PositionSide.SHORT : PositionSide.LONG,
OrderType.LIMIT,
TimeInForce.GTC,
quantity.toString(),
null, //takeprofit.toString(), //Price
"true", //Reduce only
null, //NewClientOrderId
takeprofit.toString(), //Stop price
null, //workingType
NewOrderRespType.RESULT //NewOrderRespType
);
I’ve tried using the stop price instead of price, and also in one-way mode but it I can not get it to work