Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Exchange-Style Order Book (Level 3)

A Python implementation of an exchange-like limit order book with full Level 3 (per-order) depth, Level 2 (aggregated) snapshots, and a price–time priority matching engine.

This project is designed to demonstrate core market microstructure concepts such as FIFO matching, partial fills, order lifecycle management, and event-driven execution — similar to how real electronic exchanges operate.


Features

Core Matching Engine

  • Price–time priority (best price first, FIFO within price)
  • Supports LIMIT and MARKET orders
  • Partial fills and multi-fill execution
  • Market-neutral matching logic (no crossing errors)

Order Lifecycle

  • NEW
  • REST
  • PARTIAL FILL
  • FILLED
  • CANCELED
  • REPLACED
  • REJECTED

Performance-Oriented Design

  • O(1) cancel and replace using intrusive linked lists
  • Efficient per-price FIFO queues
  • Sorted price ladders for best bid / best ask lookup

Market Data Views

  • Level 3 (L3): full per-order queues at each price level
  • Level 2 (L2): aggregated depth by price
  • Top-of-book (best bid / best ask)

Event Feed

  • Exchange-style event stream:
    • NEW, TRADE, FILL, PARTIAL, CANCEL, REPLACE, REJECT
  • Suitable for simulation, backtesting, or latency modeling

About

Exchange-style Level 3 limit order book with price–time priority matching, event-driven execution, and Level 2 market depth in Python.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages