- TL;DR
- Miniature exchange prototype built to understand order matching, order books, real-time streaming, balances, and async processing.
- Problem - Explore how an exchange handles
- Order → Match → Fill → Balance/Position → Live Update and scales market-data streaming across thousands of instruments.
- System Requirements
- Market & limit order + Order book & fills ( Order book )
- Balance & Positions + Order book recovery
- Streaming Live quotes + Subscription manager ( 8000+ ticker )
- Naive Architecture we had follow for the project.
- In this diagram, we have an API layer that pushes each transaction into a queue. A background job, the matching engine, takes each transaction from the queue and processes it. Any unmatched orders remain on the order book.
- The matching engine then publishes the updated information to the DB process, where the data is handled by the DB filler.
- The matching engine acts as the publisher, while the API and WebSocket services act as subscribers, consuming these updates and reflecting them from the user's point of view.

- An architecture an actual Exchange works → Like Binance, Backpack etc…
- Each order book is typically single-writer/serially processed to preserve deterministic price-time priority; the scalability comes from running many books/partitions in parallel, not multiple writers modifying the same book.
- Our prototype simplifies this by keeping multiple order books inside a single matching engine.
