I can provide you with an article on this topic.
What happens to the order book when a market order is received
Imagine a bitcoin exchange is configured to offer market orders. Let’s say they have X market buy orders and Y market sell orders (no limit orders). Now let’s say we are talking about the case where a buyer places a market order on the exchange.
What happens next?
- Matching: The exchange’s algorithm will automatically match the market orders to create new trades that respond to both sides of the order book.
- Price Determination: Since there are no limit orders, the price at which these trades are matched is determined solely by market supply and demand.
How does it work?
In this scenario:
- The buyer places a market order for an amount of Bitcoin (e.g. 1 BTC).
- The exchange algorithm automatically combines this order to create a new trade:
- A buy order with the same BTC amount (e.g. 1 BTC) and a market price of $30,000.
- A sell order with the same BTC amount (e.g. 1 BTC) and a market price of $20,000.
Price Determination
The exchange algorithm will determine the new price at which these trades are matched. In this example:
- The buy order is combined to create a trade where you buy 1 BTC at a price that is between $30,000 and $20,000 (e.g. $25,500).
- The sell order is also combined to create a new trade where you sell 1 BTC at a price higher than what you paid for it ($35,000).
What happens if there are no limit orders on the buy or sell side?
If there are no limit orders on the buy or sell side, prices would be determined by the most active traders in the market. In this case:
*The trade may not close at $25,500 because multiple traders are bidding up and down at that price.
*The market may become more volatile as traders take advantage of the imbalance.
Conclusion
In short, when a market order is received on the exchange’s order book, it will automatically be combined with other orders to create new trades. The prices at which these trades are tied depend solely on market supply and demand, without taking into account limit orders or other factors that may affect prices.