Learn / Library / Market making
Matching order books
Venue A offers to sell units at and units at . Venue B offers to buy units at and units at . A trader buys from A and sells to B, taking every trade that has a positive profit and matching the best prices first. What is the total profit?
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
Pair the cheapest offers with the highest bids until the gap closes.
Solution
- The first units are bought at and sold at , earning .
- The next units are bought at and sold at , earning .
- The next offer at is above the remaining bid at , so the total profit is .
Answer: