Order Matching Engine
Build a high-performance matching engine that processes 1,000,000 orders, executes trades, and computes P&L. Beat the clock.
The Problem
Given 1,000,000 order events (limit orders, market orders, cancels) for a single instrument, implement a price-time priority order book that matches trades and computes per-trader P&L on a FIFO basis.
Your engine must handle self-trade prevention, partial fills, and Immediate-or-Kill semantics for market orders. Output must match the reference solution exactly.
Performance Tiers
| GOLD | < 500 ms | Exceptional |
| SILVER | < 2 s | Strong |
| BRONZE | < 10 s | Acceptable |
| FAIL | > 10 s | Below bar |
Python solutions use relaxed tiers (Gold < 5s).
Supported Languages
Full Problem Spec
The complete specification includes input/output schemas, matching rules, P&L calculation details, FAQ, and hints.
Starter Templates
Download a skeleton for your preferred language. Each includes CSV parsing, struct definitions, and TODO markers for the core logic.
Evaluation Criteria
Correctness (50%)
Trade output must exactly match the reference (order IDs, prices, quantities). P&L values within ±$0.01. Edge cases: self-trade prevention, cancel of partially-filled orders, market orders with no liquidity.
Performance (30%)
Wall-clock time on the 1M order dataset. Memory usage (peak RSS). We may test scaling behavior with 10M rows.
Code Quality (20%)
Data structure choices and justification. Memory layout and cache efficiency. Error handling and robustness. Clarity and readability. Submit a DESIGN.md explaining your approach.