The screenshot below is from Exocharts. I am looking into the API, but I can’t quite understand which endpoints I should use to create a similar DOM.
As far as I understand, the real-time order book entries (limit buy and sell orders) are streamed over wss://stream.binance.com:9443.
What about the market orders that appear as red and green right beside the price column? Which streaming endpoint provides the market orders in real-time?
Why would market orders go into the book? They are executed immediately. Market orders take liquidty from the market. Limit orders a.k.a passive or pending orders. When a market order is executed, let’s say a market buy, a limit from ASK will be reduced as much as the size of market order. They will not go into the book but you will receive an aggTrade message from the stream if have subscribed to that pair’s stream.
Thank you for your response. I understand that market orders are not included in the order book, but I was curious about how they interact with it. Your explanation clarifies this for me. So basically, to replicate the layout, I need to stream the limit orders from the order book, while getting the aggregated data of trade executions (market buys/sells), and then make the necessary additions or subtractions.
Also remember in Aggregate Trade Streams “m” means if the buyer is market maker or not. If it’s true, a market sell order executed, if it’s false a market buy order executed.
To be more clear, if buyer is maker (true) there was a limit buy order and somebody sold to that guy via market order.