Prepping for the 2027 recruiting cycle? Use code 2027RC for 10% off, valid until July 31st! Oh, and check out our members-only recruitment services.

Logo

Coding preview

Limit Order Book Fills

What this preview is

About this preview

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

Unlock full access to getcracked

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

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