Skip to main content

EduMatcher

Learn how real trading systems work. Build it from first principles.

Category Link
Repo URL GitHub
Package GitHub release PyPI version Python 3.13+
Documentation Documentation
CI/CD CI
Code Quality Coverage Code style: black Checked with mypy Linting: flake8
License License: MIT

EduMatcher is an educational trading system that teaches market microstructure, matching logic, and exchange architecture through runnable code.

It is a real exchange, not a simulation of one: a matching engine, a session scheduler, order-entry and market-data gateways, clearing, audit and statistics services, browser front-ends, and its own wire protocols — all running as separate processes that talk to each other the way a real venue's do.

Quick start

With Podman or Docker installed, one command gets you a running exchange and four web applications:

curl -fsSL https://raw.githubusercontent.com/johan162/EduMatcher/main/deployment/curl/install.sh | bash
cd ~/.edumatcher 

The exchange is now running on a bundled configuration.
The pm-* commands used throughout this guide live inside the container. To easily open a shell in the container type

./edumatcher.sh shell        # then pm-help, pm-admin, pm-alf-console, pm-stats-cli, ...

Once inside the container, start with reviewing available commands

pm-help

Then open the user-friendly Web applications :

Prefer the Python package? pipx install edumatcher, then pm-setup. Both routes, and three more, are covered in Installation.

New here? A Path Through the Guide is a staged route from the command above to running a venue of your own, with a checkpoint at every step.

Why EduMatcher?

  • Real exchange mechanics: order books, auctions, clearing, and risk controls
  • Multi-process architecture: gateway, engine, audit, clearing, stats, and tooling
  • Performance-aware implementation: ~80,000 orders/second with microsecond latency on a Linux server
  • Practical protocol design: ALF (ALmost Fix) command language for gateway order entry, RALF (Reconciliation ALF) for post trade consumers and CALF (Channel ALF) to serve market data to subscribers, and finally BALF (Binary ALF) for high performance trade clients
  • Strong engineering discipline: type hints, linting, and high test coverage

Key Features

  • Complete lifecycle: order entry, matching, clearing, and audit trail
  • Rich order support: MARKET, LIMIT, STOP, STOP_LIMIT, IOC/FOK, ICEBERG, combo, OCO
  • Market mechanisms: opening/closing auctions
  • Risk handling with circuit breakers and price collars
  • Message-based process boundaries with strong observability
  • Real risk controls: price collars, kill switch, circuit breakers, and mass cancel
  • Easy to understand configuration through single source engine_config.yaml which acts as the system reference data. To simplify its creation either Web-based tool (http://localhost:8092/) or a CLI tool pm-config-gen can be used. In addition it is of course possible to manually create a handwritten config file that can be verified with pm-cverifier. To guarantee correctness and that it is a single-source of truth the YAML file is then compiled and checked by pm-deploy-config to be automatically stored in the canonical location used by the system.

Documentation

Main documentation site EduMatcher Documentation that among other things includes:

  • How an Exchange Works: a primer on exchange mechanics and market microstructure concepts aimed at software developers with no prior financial experience
  • Exchange Concepts: deep dive in core technical concept of an exchange
  • User Guide: step-by-step instructions for installation, configuration, and running EduMatcher
  • Training Material: self-paced exercises to learn how to setup and manage the Exchange
  • Architecture: an overview of the SW architecture
  • Developer Guide: deep dive into the architecture, design decisions, and code structure. Necessary reading for anyone wanting to contribute!
  • Glossary: the finance world uses lot of specialized terms, this glossary lists the most important with an explanation

Note: Running an exchange is an inherently complex task and there is only so much that can be simplified. The user guide and training material are built to get you through it.

Performance

EduMatcher does not aim to match venues like NYSE or LSE, but it is still fairly fast for a purely Python educational project. The figures below reflect the performance on an high end Linux server with risk checks enabled (price collar and circuit-breaker).

Latency (engine-only, n=1,000 each)

Order type min (µs) median (µs) P80 (µs) P90 (µs) max (µs)
Limit 47.785 49.702 50.748 53.206 84.664
Market 47.209 49.428 50.571 54.191 89.989

Throughput

Metric Value
Max TPS ~29,122 orders/second
µs / order (mean) 34.3 µs
Order mix 20% Market, 30% aggressive Limit, 50% passive Limit

Performance note: price-collar and circuit-breaker checks run in the hot path for every match. They are required for realistic risk control and add measurable cost.

Key Functional and Infrastructure Limitations

  • Very limited authentication & authorization
  • No combo-order books (combo orders are supported with coupled order books)
  • No implied (synthetic) orders
  • No primary-secondary automatic site failover
  • No load balancing
  • Limited replay for participants that lose the connection
  • MARKET orders are rejected during a circuit-breaker halt rather than joining the reopening auction. Both Nasdaq and Xetra accept them into the call; here the uncross prices interest by book level, so unpriced interest has no level to sit at and would be invisible to compute_equilibrium()
  • The ACE expansion ladder is exchange-wide only

Contributing

Contributions are welcome. Start with the Developer Guide, which covers the development environment, testing and the conventions this project follows, then open an issue or pull request on GitHub.

Release notes for every version are in CHANGELOG.md.

Citation

If you use this tool in teaching or courses, please cite:

@software{edumatcher,
  title = {EduMatcher},
  author = {Johan Persson},
  year = {2026},
  url = {https://github.com/johan162/EduMatcher},
  version = {0.40.3}
}

License

MIT License - see LICENSE.

Release files for edumatcher 0.40.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edumatcher 0.40.3
File Size Uploaded
edumatcher-0.40.3.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for edumatcher 0.40.3
File Interpreter ABI Platform
edumatcher-0.40.3-py3-none-any.whl Python 3 none any Details

Total release size: 3.0 MB

Release files / edumatcher-0.40.3.tar.gz

Download URL edumatcher-0.40.3.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
b06c8d2fdc4d2f78804d04273b8923ddefea074ee47257c8ec1155bff93de30f
BLAKE2b-256 checksum
How to use checksums
a823e6a3272500e24479e0291cc6b5db5ba6417924499b4b6d406ae00c38dd38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.0 CPython/3.12.3 Linux/6.17.0-1022-azure

Release files / edumatcher-0.40.3-py3-none-any.whl

Download URL edumatcher-0.40.3-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0a516ac33fbb57279b8ba3e118bb85f3751530f190ed8869abaf09fe11c45083
BLAKE2b-256 checksum
How to use checksums
f8dcf2f27616248734bce38c2c9cac920fc64e988dcfa74edf5463dfdd354755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.0 CPython/3.12.3 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

0.41.1

2 release files

0.41.0

2 release files

0.40.5

2 release files

0.40.4

2 release files

This release

0.40.3 This release

2 release files

0.40.2

2 release files

0.40.1

2 release files

0.39.0

2 release files

0.38.1

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.0

2 release files

0.27.3

2 release files

0.27.2

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.3

2 release files

0.26.2

2 release files

0.26.1

2 release files

0.26.0

2 release files

0.20.4

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.17.0

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page