The first scenario is the right idea.
The reason I tried to implement it like this is specifically because the API is way too slow to place orders in reaction to a WS message if the prices are too close. If Binance offered co-location like Forex brokers where you can complain things are too slow it if takes 1ms roundtrip, it would be an option, but right now by the time you’re getting a WS message and send the REST resquest (even while keeping the rest connection alive so a socket doesn’t have to be allocated), it’s too slow to react on tiny price changes.
Keep in mind that I’m porting code that runs on another platform, so the model is valid. I’m actually pretty much on my own trying to prove that extending to Binance would make sense. So I need to find a way to pre-submit the open and close with very tight prices because relying on the a server roundtrip with the current performance is a non starter.
“you cannot assure #1 can open an order successfully before #2 can be triggered and take actions” this is specifically where the problem is. In the mid 90s, you had brokers that were handling stop orders and then passing an order on the market, on your behalf. To some extent, that practice still exists on some markets, but since Binance is the exchange itself and there is no 3rd party involved, I don’t understand why the process is separated into two steps that can’t be guaranteed to work in the execution step.
The issue here is that if the execution of the stop triggers another process which doesn’t have a guarantee in execution time, and where the exchange doesn’t really support many features on the orders themselves (like contingent / chained orders, OCOs, etc), the mechanism is quite dangerous and I think the exact workings of it should be very clearly documented.
Additionally having an order expire to generate another order… OR not ,is another reliability issue because we know from the WS that the stop has been hit but then we know nothing else; how long should I wait to decide if the new order will be placed… or not? there is no guaranteed execution time there either.
So, I am trying find how to make that scenario work on Binance. At the root, I need an order to trigger another one when it starts to fill, and they can be extremely close to each other.
The strategy we’re running, and I’m trying to port, is some market making hybrid where I need to satisfy the condition above in many scenarios.