-
Notifications
You must be signed in to change notification settings - Fork 65
Home
Ash Booth edited this page Aug 14, 2026
·
19 revisions
A limit order book for simulation research, written in Python. Repository · README · Issues
Rewritten 2026-08-14. Most of this wiki described a pure-Python red-black-tree implementation that was replaced in 2023 and a SQL-backed engine retired in 2026. Those pages are now either rewritten against the shipped library or marked as historical. If you followed a link here from a search result and the page you landed on carries a Historical record banner, the current guides are below.
| Page | What it covers |
|---|---|
| Usage walkthrough | Build a book, submit limit and market orders, cancel, modify, read the book. Price-time priority, the maker-price rule, the self-match gate, balances and commissions. Every example is real output from the shipped library. |
| Recording and analysis | Attach a SQLiteSink and get the session back as queryable history. The schema, research questions in SQL and pandas, recovering a killed run, and the WAL sidecar trap. |
The README is the front door: installation, a short quickstart, the capability specs, benchmarking, and a reading map. This wiki is where the longer form lives.
| Page | |
|---|---|
| Introduction | What a continuous double auction and a limit order book are, and what "level 2" market data means. General market microstructure; still accurate. |
| Implementation | Historical. The 2013 red-black-tree design and the reasoning behind it. The motivation still reads well; the data structures described are no longer in the code. |
- Price-time priority, matching in memory, single-threaded, zero latency.
- A trade prices at the maker — the resting order's limit.
- A market order is immediate-or-cancel and never rests.
- Persistence is optional and off the matching path: attach a sink, or nothing is constructed at all.
- What it is contractually required to do lives in
openspec/specs/in the repo, with acceptance tests written one per ratified scenario.