Quantitative systems / C++20
Mercury.
An execution and market-microstructure laboratory.
A price-time-priority order book, seeded market streams and five execution policies, with reproducible synthetic stress experiments.
State-dependent synthetic order flow
Shared inputs · causal decisions
CSV · replay tapes · report
Compare policies on the same market stream.
Aggressive, TWAP, participation-of-volume, passive and adaptive policies replay one frozen external tape through separate order books. Each policy sees current observations, rather than future events. Exact match records account for executed prices, maker/taker fees and residual inventory.
Saved tapes preserve the initial book and external events. The replay command evaluates all five policies without regenerating market flow. Bounded loading and integrity checks reject malformed or corrupted inputs.
Search, then evaluate on separate seeds.
Bounded random search selects a synthetic regime using TWAP CVaR95 on training seeds. The committed reference evaluates the selected regime and market-intensity neighbors on 128 disjoint seeds.
In that reference, TWAP's mean cost rises from 1.220 to 5.724 ticks per share between the baseline and selected regime; CVaR95 rises from 4.143 to 15.022. These are measured outcomes inside the model, not a calibrated real-market result.
The hosted report includes policy comparisons, uncertainty estimates and downloadable raw fills, decisions, configuration and replay files.
Reconcile the accounting.
58 C++ cases and four end-to-end checks cover matching invariants, reference-model comparisons, causal policy prefixes, exact fill accounting, serial/parallel equivalence and tape replay. Linux and macOS CI run strict Release and address/undefined-behavior sanitizer builds.
A fresh-clone script builds, tests and reproduces the reference report. Replaying a saved first seed matches its original policy outcomes within the same build.
Model assumptions.
The market is synthetic and uncalibrated. Policy orders affect their replayed queues and fills, while external arrival rates stay frozen. The engine is CPU-based; exchange connectivity, empirical calibration and GPU acceleration remain outside this release.
Experiment design and accounting