Quant engineering lab
Make price-time priority, partial fills and sequence recovery observable. Predict the result before advancing the system.
01 · Matching engine
Submit an order or load the FIFO example.
Bids
| ID | Ticks | Units | Priority |
|---|---|---|---|
| No resting orders | |||
Asks
| ID | Ticks | Units | Priority |
|---|---|---|---|
| No resting orders | |||
Trades · 0
| Sequence | Maker → taker | Price | Units |
|---|---|---|---|
| No fills yet | |||
Accepted event log · 0
[]
02 · Market-data gap and recovery
Deliver 1, then 3. The book must stop at 1 while 3 is buffered. Deliver missing 2 to drain the buffer, or recover from a trusted snapshot through 3. Duplicate delivery is idempotent.
LIVE · Waiting for sequence 1.
Bids
| ID | Ticks | Units | Priority |
|---|---|---|---|
| No resting orders | |||
Asks
| ID | Ticks | Units | Priority |
|---|---|---|---|
| No resting orders | |||
03 · Explain the design
04 · Measure native code
Compare a contiguous scan with a dependent shuffled traversal using the same dataset and checksum. Then stress a bounded C++ SPSC queue with one million FIFO values. Predict first, compile locally, and explain the observations.
c++ -std=c++20 -O3 -pthread -Wall -Wextra latency_lab.cpp -o latency_lab ./latency_lab
The program reports 21 whole-batch samples and compiler metadata. Batch percentiles are not per-message latency. The queue exercise assumes one producer, one consumer and 64-byte padding; discuss those constraints before extending it.