'how to lace OCO orders that would trigger immediately on Binance?

So I have this strategy, that relies on updating orders pretty often per minute (currently I'm doing this every 10 seconds). The buy side of the strategy is working fine, but when it comes to selling, i relie on OCO orders due to them offering me stop_loss_limit and take_profit_limit at once.

But sometimes, it happens, that the live price is either below the stop_loss_limit or above the take_profit_limit due to the delay of the rest API between cancelling the order and placing an updated one. So I get the response 'limit order would trigger immediately'. In that case, I want exactly that to happen, but Binance won't let me place this order.

Can anyone help me out with this one?

Please excuse my spelling and grammar mistakes, English is a foreign language to me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source