FoundationMultiple choice
Designing an order book · Part 1 of 3
You are writing a limit order book for one instrument. It must add orders, cancel them by order id, and publish the best bid and offer after every event. There are L occupied price levels and N resting orders, and each level keeps its orders in time priority.
Price levels live in a balanced tree keyed by price, such as std::map. What does adding an order at a price with no existing level cost?
- A to insert the new level
- B, as a hash map insert would be
- C, since every resting order must be shifted along to make room for the new level
- D, to walk to the right position
The worked solution is in Premium
The answer, the full working and the one idea to take away – for this and all 1,322 questions in the bank. Answer it in practice and your working is marked, with a known mistake named when you make one.
More systems and low latency questions
- An array-based book pre-allocates one slot per price tick.Foundation
- You join a price level behind 800 shares.Foundation
- You keep one million live orders in a hash map at 48 bytes an entry.Applied
- A buy order for 500 at a limit of $100.02 meets offers of 200 at $100.00, 100…Applied
- What data structure best supports a limit order book that must add, cancel and…Advanced
- A busy matching engine, part 1 of 3Foundation