This question already has an answer here:
I'm trying to gain some insight into how orders on an exchange are matched to design a proof of concept matching system.
Am I correct in assuming market orders are immediately executed against the best priced limit order in the limit order book if there is not another market order at the same time to fill the opposite side ?
Limit order book
Time|Buy | Time|Sell
00:01|50 | 00:02|55
00:03|53 | 00:01|60
Market buy order comes in at 00:05
Would it match with the sell limit order at 55 (because $55 is the best price) or with the order at 60 since it's the oldest ?