Low-Latency Market Data & Order Entry Stack
Price-time-priority matching engine publishing a binary feed over redundant A/B UDP multicast, with a Rust feed handler that arbitrates the two and rebuilds MBP/MBO books without allocating.
Use case
The problem space.
Consume an exchange feed and place orders against it without the decode path or the book update ever touching the heap — and recover cleanly when packets are lost rather than resynchronising by restart.
What's implemented
Built with intention.
Matching engine and binary feed01
Price-time-priority matching publishing a binary market-data feed over redundant A/B UDP multicast channels, with configurable packet-loss injection, a 2-second snapshot cycle, and a TCP replay service for recovery.
Allocation-free feed handler02
A/B feed arbitration, sequence-gap detection and snapshot-based recovery into MBP/MBO order books — sustaining 1M+ messages/sec at ~100ns decode and ~200ns book update, with zero heap allocations per message verified by a counting allocator.
FIX 4.4 order gateway03
A full session layer — logon, heartbeats, resend/gap-fill, durable sequence persistence — reconciling order state across a hard process restart, plus a risk service enforcing pre-trade limits on an allocation-free path.
Architecture
Systems in concert.
The primary request and data paths, presented as a compact operating model.
A conceptual architecture for communicating the system design and operational responsibilities.
Step by step
From zero to
running.
Representative local-development commands that show the implementation path and operating sequence.
- 01
Bring up the transport
Start the containerised multicast network and the replay service before either side of the stack connects to it.
docker compose up -d - 02
Run the matching engine
Start the engine and let it publish the binary feed on both the A and B multicast channels.
cargo run --release --bin matching-engine -- --config configs/local.toml - 03
Attach the feed handler
Point the handler at both channels; it arbitrates between them and builds the order books from whichever arrives first.
cargo run --release --bin feed-handler -- --feed-a 239.1.1.1:30001 --feed-b 239.1.1.2:30001 - 04
Prove the recovery path
Inject packet loss on one channel and confirm the handler detects the sequence gap and recovers from the snapshot rather than falling behind.
cargo run --release --bin feed-handler -- --drop-rate 0.02 --verify-allocations
