C++20 · Header-Only · Python Bindings

The order book that
runs at nanosecond speed

Production-grade matching engine for algorithmic and high-frequency trading. Zero heap allocations. Zero virtual dispatch. Full Python API.

BBO Query 31 ns p50
Market Order 108 ns p50
Cancel 82 ns p50
Test Suite 56/56 passing
Get FastBook — from €299 View benchmarks

Code

Drop-in. Single include. No dependencies.

main.cpp — C++20
// One include. Everything you need. #include <fastbook/fastbook.hpp> struct MyListener : fastbook::BookListener<MyListener> { void on_trade_impl(const Trade& t) { printf("FILL %lld @ %lld\n", t.qty, t.price); } }; MyListener listener; OrderBook book(listener); Order ask{}; ask.id=1; ask.side = Side::Sell; ask.price = 10000; ask.qty = 100; book.add(ask);
strategy.py — Python 3
import fastbook class Strategy(fastbook.Listener): def on_trade(self, t): print(f"FILL {t.qty} @ {t.price}") def on_bbo_change(self, bid, bq, ask, aq): spread = ask - bid if spread < 5: self.fire_signal() book = fastbook.OrderBook(Strategy()) book.add(fastbook.Order( id=1, side=fastbook.BUY, type=fastbook.LIMIT, price=10000, qty=50, symbol="BTC-USD"))

Built for the hot path

Zero heap allocations
Lock-free memory pool pre-allocates all order and node memory at startup. After init, the hot path never touches malloc or free.
Cache-aligned Order struct
The Order struct is exactly 64 bytes — one cache line. The CPU fetches an entire order in a single memory operation.
Zero virtual dispatch
CRTP callbacks resolve entirely at compile time. The compiler can inline your listener directly into the matching loop.
Complete matching engine
Limit, market, IOC, and FOK orders. Price-time priority (FIFO) per level. Cancel and reduce-qty in O(1).
Python bindings included
Write strategies in Python, execute in C++. Full event callbacks, BBO query, depth snapshot — all exposed to Python.
56-test suite + benchmarks
Every code path tested. Nanosecond-precision latency benchmark included. Ship with confidence.

Performance

Measured. Not estimated.

Single-threaded, x86-64, GCC 13.3 -O3 -march=native. 100,000 samples. Includes steady_clock overhead (~15 ns).

Operation p50 p95 p99 Notes
BBO query 31 ns 32 ns 33 ns best_bid() + best_ask()
Cancel order 82 ns 167 ns 204 ns O(1) hash map + intrusive list
Market order (1 fill) 108 ns 213 ns 270 ns match + emit trade event
Add limit (100 resting) 111 ns 166 ns 204 ns no match, rests in book
Depth snapshot (10 levels) ~180 ns O(depth) map iteration

Run ./bench_latency on your own hardware to reproduce.

Pricing

One-time payment. Yours forever.

No subscriptions. No seats. Buy once, use forever. Includes 12 months of updates.

Individual
€299one-time
For independent developers and researchers
  • 1 developer licence
  • Personal & research use
  • Full source code
  • C++ + Python bindings
  • 56 tests + benchmark
  • 12 months of updates
  • Not for commercial products
Buy Individual
Team
€799one-time
For small teams building internal systems
  • Up to 5 developers
  • Internal tools & systems
  • Full source code
  • C++ + Python bindings
  • 56 tests + benchmark
  • 12 months of updates
  • Internal use only
Buy Team
Need source modification rights or custom integration? Contact us for Enterprise

FAQ

Common questions

What do I receive after purchase?
A ZIP archive containing the full source code: all C++ headers, Python bindings, unit tests, benchmarks, examples, documentation, and CMakeLists.txt. Delivered instantly via Lemon Squeezy.
Does it work on Windows and macOS?
The C++ library is standard C++20 and works on Linux, macOS, and Windows (MSVC 2022+, GCC 10+, Clang 12+). The Python extension requires a C++20-capable compiler.
Can I use this in a live trading system?
Yes, under the Team or Commercial licence. The library is designed for exactly this use case. The disclaimer in the licence applies: you are responsible for validating behaviour in your own system before deploying capital.
Is there a refund policy?
Yes — 14-day no-questions refund via Lemon Squeezy if the library does not work as documented on your platform.
Does it support FIX protocol or WebSocket feeds?
Not natively — FastBook is the matching engine layer. You parse your feed (FIX, WebSocket, REST) in your own code and call book.add() with the resulting Order struct. This keeps the library focused and dependency-free.
Will there be updates?
Yes. Your purchase includes 12 months of updates delivered via the same download link. Planned features: FIX message parser, Python async callbacks, backtesting utilities.