← Back to projects

04.2026

Ultra-Low-Latency Order Matching Engine

A deterministic C++20 limit order matching engine with FIFO price-time priority, preallocated memory pools, FastAPI gateway, and real-time WebSockets.

C++PythonFastAPIWebSocketsNext.jsTypeScriptDocker
Ultra-Low-Latency Order Matching Engine cover

Introduction

An ultra-low latency, deterministic order matching engine implemented in modern C++20, engineered for predictable execution speeds, minimal jitter, and zero dynamic memory allocation in the critical path.

Architectural Highlights

  • C++20 Deterministic Core: Implements FIFO price-time priority matching with support for limit orders, market orders, partial fills, and instant cancellations.
  • Pre-Allocated Memory Pools: Cuts heap allocation overhead completely during order matching to eliminate garbage collection delays and minimize CPU cache misses.
  • Fixed-Point Arithmetic: Utilizes 64-bit integer fixed-point arithmetic for price and quantity calculations to guarantee zero floating-point rounding errors and cross-platform determinism.
  • Python Bindings via pybind11: Bridges high-performance C++ execution with an asynchronous FastAPI gateway.
  • Real-Time Streaming: Broadcasts trades and Level-2 order-book market depth over low-latency WebSockets.
  • Trading Terminal: Responsive Next.js 14 frontend with Zustand state management, order entry widgets, and live depth charts.

Explore the source code on GitHub