- this is not a problem; the price moved while the orders were processed and it’s ok that they’re both executed instantly.
- what I called ‘Binance id’ is the column B of the excel, it’s the numerical value that shows the execution order (as opposite to my ClientId)
- I’m not ‘suspicious’, but I need to understand fill rules to have some deterministic process.
Currently:
- We can’t trust the insertion order when submitting several orders at once, so we have to submit them separately if we want them to be filled in order (assuming Binance gives priority to age, like brokers commonly do, but it’s again not documented anywhere).
- We can’t trust the reporting mechanism with sockets because notifications can arrive out of order when the system is ‘busy’, with ‘busy’ not defined anywhere.
- We can’t trust the reporting through the rest interface, because not only it’s slow, it’s not accurate in many cases as discussed daily on Telegram (and this is not documented properly as well).
- We can’t rely on a steady insertion speed because it seems to vary a lot and there is no guarantee there.
So, hopefully, we can trust the order fill system to be deterministic so we can at least rely on one thing.
Here is a bit of background: I’ve been trying for a few month to initiate a move to Binance, porting tech that was built for another platform.
The trades normally have very low price deltas with fairly high volumes, which means speed is pretty much everything.
I understand that Binance doesn’t charge for access and therefore doesn’t offer any guarantees when it comes to things like insertion speed, notification latency, etc which means that everything has to be organized in a semi-blind way to be able to mitigate issues.
Now, here is why this matters to me:
Let’s say I send short open orders A and B, where A’s price is lower than B. The price moves quickly and both orders get filled.
- If I receive A’s filled notification first, I can assume that A was filled and I don’t know anything about B, so I can set the close order for A. Now I have a close order which is far from the last price (which passed B), and will only have the quantity of A (unless I let the exchange set the quantity for me).
- If I receive B’s filled notification first, I can assume that both A and B were filled, and I can set the close based on this.
So just by having notifications out of order, there is already an issue, but there are workarounds.
Now, what if we have the same scenario, but there are not filled in the same order:
B gets filled first and then there is not enough volume available to fill A? Now I can’t assume that B being filled means that A got filled. I can’t assume that A will not somehow get filled while I’m sending the close order, so I have to rely on the socket’s messages. But now, I may get a B filled then later an A partially filled notification, OR I may get an A partially filled and later a B filled notification. How I have to react to these is different.
Since we can’t rely on any kind of reporting, I would like to know that I can trust that the fill rules are deterministic, and, for example:
- When several orders have to be filled, the get filled oldest first, or
- When several orders have to be filled, the furthest to the price gets filled first, or
- When several orders have to be filled, the one with the smallest quantity gets filled first
Something, anything really, that is 100% reliable and I can use to base a reaction on because I can’t trust the time of the reporting, nor the contents.
In most cases, it would be irrelevant, but in a case where you do tiny deltas with large quantities, this is essential. Right now I’ve been running tests with tiny amounts and I already see these problems pop up again and again, day after day.
This is why understanding the exact rule about how orders are filled is very important here. It’s not suspicion