I'm trying to understand how order fulfillment algorithm works from technical point of view.
Let's say I created an order to sell 0.8 BTC and buy 5400 XRP along with other orders to sell 0.35 BTC, 2.7 BTC, etc. On the other side, there are some traders who sell different amount of XRP to but BTC.
To be more specific, imagine:
trader1 wants to sell 0.8 BTC,
trader2 wants to sell 2.7 BTC ...
But there are no traders that are willing to sell exactly the same amount of XRP. There is a traderX who wants to sell 7000 XRP so in this case he may have a deal with trader1 and partial deal with trader2. However, this is not how all exchangers work, right? Usually all orders processed as a single transaction.
So how all these orders match to have a trading? Any algorithm or code in any programming language would be very helpful. Thank you!