01
the problem
A trading simulation needs deterministic validation, price-time matching, partial fills, and a way to expose engine results to a browser.
case study 05 / C++ systems exercise
An educational flower-order exchange simulator with a C++ matching engine, batch CSV mode, TCP server, Node.js bridge, and React dashboard.
01
A trading simulation needs deterministic validation, price-time matching, partial fills, and a way to expose engine results to a browser.
02
Implemented the repository individually: matching and validation logic, order books, execution reports, concurrent TCP handling, WebSocket bridge, and browser dashboard.
03
Represent each price level with an ordered map and FIFO queue, then protect each order book with a mutex so concurrent client threads preserve matching state.
visual evidence pending
No repository screenshot is published for this project. A real application capture should replace this clearly marked placeholder.
stage 01
CSV or browser order
stage 02
Validation
stage 03
Instrument order book
stage 04
Price-time matching
stage 05
Execution reports
stage 06
CSV or live dashboard
Validates required fields, supported instruments, side, positive price, and quantity rules.
Maintains price-sorted buy and sell maps with FIFO queues at each price level.
Supports full and partial executions at the resting order’s price.
Provides batch CSV processing plus a multithreaded Windows TCP server.
Streams browser orders and execution reports through a Node.js Socket.IO-to-TCP bridge.
This is an educational exchange simulation, not a production or high-frequency trading platform.
The repository contains scenario CSV inputs and expected outputs but no automated unit-test framework.
The TCP server is Windows-specific and the protocol is a simple delimiter-based text format.
Keeping partial-fill reports and remaining quantities correct for both aggressing and resting orders across batch and network modes.
Data-structure choice, ordering guarantees, and I/O boundaries directly shape the behavior of stateful systems.