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

Limit Order Book Fills

What this preview is

Limit Order Book Fills is a easy quant coding problem on language knowledge in Python, asked at Quant.

Difficulty
Easy
Topic
Language Knowledge
Discipline
Quant development
Language
Python

Implementing a limit order book matching engine in Python

This easy coding problem tests your ability to simulate the core logic of an exchange's order-matching system. It is representative of the kind of finance-domain coding round used by quant trading firms to assess whether you understand market microstructure and can implement a greedy matching algorithm correctly.

The problem requires you to maintain two data structures—one for resting buy orders and one for resting sell orders—and apply price-time priority matching rules as each new order arrives. Key challenges include tracking unfilled quantities, efficiently retrieving the best counterparty order at each step, and accumulating the total filled quantity. A clean solution focuses on choosing the right data structures (such as heaps or sorted containers) to make best-order retrieval fast and keeping the matching loop simple and obviously correct.

  • Greedy matching and order priority
  • Maintaining multiple order books by side
  • Heap or priority-queue operations in Python
  • Handling partial fills and resting quantity

Unlock full access to getcracked

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