Order Book Sim

Python icon
Python
Kafka icon
Kafka
TypeScript icon
TypeScript
Orderbook Sim image
Order Book Sim is a fully dockerized, microservice-based simulation of a real-time trading order book. The system consists of a Kafka producer, consumer, and an NGINX reverse proxy, enabling scalable ingestion, processing, and distribution of high-frequency bid/ask data. It is deployed via GitHub Actions to AWS and exposed behind a proxy for reliable external access.
The backend is built with FastAPI using asynchronous Python (asyncio), leveraging AIOKafka for non-blocking message consumption and WebSockets to broadcast low-latency updates to connected clients. The frontend, hosted on Vercel and written in React with TypeScript, is designed to efficiently render streaming data, allowing individual cells to update independently as events are received.
Simulations are configurable by specifying the number of generated trades and a delay between messages. For maximum throughput testing, a rate of -1 can be used to send messages as fast as possible. During execution, real-time metrics are displayed to provide insight into system performance and message processing speed.
A future iteration will include a Java-based backend implementation to benchmark and compare performance characteristics against the current Python async architecture under high-throughput workloads.