Skip to content

jamescarter2001/matching-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matching Engine

A high-performance, low-latency order matching engine written in Java.

Prerequisites

  • Java 25 or later
  • Maven 3.6+

Features

  • Order Management: Add, match, and cancel orders for multiple financial instruments
  • Real-time Matching: Efficient price-time priority matching algorithm
  • Event Publishing: Publishes trade and order events to downstream consumers

Architecture

The matching engine is built using modern Java technologies optimised for low latency:

  • Agrona: High-performance data structures and utilities
  • Simple Binary Encoding (SBE): Efficient binary encoding for request messages
  • LMAX Disruptor: High-throughput inter-thread messaging library for event processing. Each instance is written to by a single thread, which mitigates the need for more expensive CAS operations by the internal sequencer

Core Components

  • MatchingEngine: Main engine managing multiple order books
  • OrderBook: Individual order book implementation with price levels
  • OrderPool: Memory pool for order objects to eliminate allocations on the hot path. This is critical for avoiding garbage collection pauses
  • Event publishers for trade and order updates

About

A high-performance, low-latency order matching engine written in Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages