The order matching algorithms popularly used by electronic financial exchanges include FIFO or pro-rata or other variants. The use case where the order amount matches or is within the margin of the tick is a happy-path scenario. I want to know how do these algorithms operate when the order amount don't match?
Scenario 1 - If a partial fill happens and out of 100 order, 50 orders gets filled. The residual order book will hold the remaining 50. So what happens with these 50? How long do they have to wait?
Scenario 2 - If the buy order is for $50, and no sell order comes in which is below $60. So what would happen to these kind of orphaned orders?