We use optional cookies for analytics and affiliate attribution. Essential cookies and marketing measurement are always on. Read our privacy policy

We just launched our Black Friday sale. You can use code BF2026 to get 25% off all subscriptions, valid until Nov 30th. There is a limit of 100 redemptions.

Logo

Implement an orderbook

What this preview is

Implement an orderbook is a medium quant coding problem on language knowledge in Cpp / Python, asked at Quant.

Difficulty
Medium
Topic
Language Knowledge
Discipline
Quant development and Quant trading
Languages
Cpp / Python

What this orderbook implementation problem tests

This is a medium-difficulty coding problem common at quantitative trading firms. It requires you to build a core market microstructure component—an orderbook that matches buy and sell orders in real time. The problem tests your ability to combine multiple data structures and rules into a working system that handles both correctness and efficiency.

Solving it well means choosing the right data structures to support price-priority and time-priority matching, implementing partial fills and order cancellation, and reasoning clearly about edge cases like duplicate order IDs and non-crossing prices. You'll need to track bids and asks separately, manage quantity across multiple matches, and identify the aggressor (the order that arrives second and triggers the trade).

  • Price-priority and FIFO ordering within price levels
  • Partial fills and order lifecycle management
  • Efficient lookup, insertion, and removal by order ID and price
  • Symmetry between buy and sell matching logic

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.