OW
cd ..~/projects/flower-exchange

case study 05 / C++ systems exercise

Flower Exchange

An educational flower-order exchange simulator with a C++ matching engine, batch CSV mode, TCP server, Node.js bridge, and React dashboard.

status
Completed
ownership
Individual
stages
06
stack
07
  • C++
  • STL
  • TCP/IP
  • Multithreading
  • Node.js
  • WebSockets
  • React

Project overview

01

the problem

A trading simulation needs deterministic validation, price-time matching, partial fills, and a way to expose engine results to a browser.

02

my contribution

Implemented the repository individually: matching and validation logic, order books, execution reports, concurrent TCP handling, WebSocket bridge, and browser dashboard.

03

key decision

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.

04 / how it works

System flow

implemented — verified against source5
  1. Validates required fields, supported instruments, side, positive price, and quantity rules.

  2. Maintains price-sorted buy and sell maps with FIFO queues at each price level.

  3. Supports full and partial executions at the resting order’s price.

  4. Provides batch CSV processing plus a multithreaded Windows TCP server.

  5. Streams browser orders and execution reports through a Node.js Socket.IO-to-TCP bridge.

What is implemented and what is not

known limitations3
  • 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.

hardest part

Keeping partial-fill reports and remaining quantities correct for both aggressing and resting orders across batch and network modes.

what I learned

Data-structure choice, ordering guarantees, and I/O boundaries directly shape the behavior of stateful systems.