I can provide an article on the subject.
What happens to the order book when a market order comes in
Imagine a bitcoin exchange is set up to offer market orders. Let’s say they have X buy orders at the market price and Y sell orders at the market price (an unlimited order). Let’s say we’re talking about a case where the buyer places a market order on the exchange.
What happens next?
- Matching: The exchange’s algorithm automatically matches the market orders to create new trades that fill 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 matches this order to create a new trade:
- A buy-side order for the same amount of BTC (say 1 BTC) and a market price of $30,000.
- A sell-side order for the same amount of BTC (say 1 BTC) and a market price of $20,000.
Price Determination
The exchange algorithm determines the new price at which these trades are matched. In this example:
- The buy order is matched to create a trade where you buy 1 BTC at a price that is midway between $30,000 and $20,000 (let’s say $25,500).
- The sell order is matched to create a new trade where you sell 1 BTC at a higher price than you paid ($35,000).
What if there were no limit orders on the buy or sell side?
If there were no limit orders on either the buy or sell side, prices would be set 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 summary, when a market order enters an exchange’s order book, it is automatically matched with other orders to create new trades. The prices at which these trades are matched depend solely on market supply and demand, without taking into account limit orders or other factors that may affect pricing.