Order Book Simulator
financepythonfastapiwebsocketsredis
A real-time limit order book simulator with a price-time priority matching engine, WebSocket streaming, Redis persistence, and a live web dashboard.
What it is
A central limit order book built from scratch: price-time priority matching, limit/market/IOC/FOK orders, cancellation and amendment, and self-trade prevention. A synthetic market driven by an Ornstein-Uhlenbeck process and three agent archetypes — market makers, noise traders, momentum traders — generates realistic microstructure. Depth, trade, and order events stream over WebSockets to a dashboard with a depth ladder, trade tape, and manual order entry, with Redis handling persistence and pub/sub.
Why it matters
Exchange matching engines are black boxes. Building one end to end — and a market to feed it — is the clearest way to understand how liquidity, priority, and order types actually interact.
Stack
Python 3.11FastAPIWebSocketsRedisPydanticasyncio