My strategy can involve multiple OTO orders, involving multiple LIMIT SELL orders, AT THE SAME PRICE, but differing quantities.
I’ve noticed now that when the limit is hit, ONLY ONE of the limit Sells is filled.
I’m guessing this is a bug in the Binance system, whereby it’s only detecting the FIRST Limit Sell order for a particular price. Is that plausible?
The unfilled Limit Sell Order simply remains on the system, as unfilled.
I could tweak the limit prices so that they’re not identical. Might that help?
Thank you
How do you detect this? Are you the maker or the taker when it happens?
Is this something you see in the initial API response? When querying the order status later? When listening to the user data stream events?
Both orders should trade, if there is enough quantity on in the counter-orders on the BUY side.
If you’re the taker — i.e., both orders would immediately trade — note that the “pending” order activation happens as a separate event. In the API response you will see the “working” order to be FILLED, and the second “pending” order in PENDING_NEW state. Although, in fact the pending order also trades, but you need to query its status separately after that.
If you’re the maker, it might be possible that only the “working” order gets filled if someone else places a BUY order for exactly the quantity of the working order (as it is visible on the order book).
For example, if you place the following OTO:
(working) SELL 0.01 BTC @ 100,000 USDT
(pending) SELL 0.99 BTC @ 100,000 USDT
then everybody will see your offer to sell 0.01 BTC for 100,000 USDT.
Then if somebody places an order exactly for exactly that quantity:
BUY 0.01 BTC @ 100,000 USDT
then only your working order gets filled. The pending order activates but does not trade yet.
Apologies, I’m daft!
I’ve now carefully checked the transaction times, and the second OTO Limit Sell Order hadn’t even been created yet, since its parent Limit Buy hadn’t yet been filled, at the time that the first OTO Limit Sell Order was filled.
In other words price dropped to trigger 2x OTO Limit Buys, but it rose after the first to trigger the partner Limit Sell, before quickly dropping again to trigger the 2nd OTO Limit Buy, leaving the 2nd Limit Sell, CORRECTLY, unfilled.
Sorry!