Skip to primary interaction
Finance

Exchange Engine

Markets systems build that runs a live order book, matches orders by price-time priority across limit, market, FOK, IOC and GTC, prints fills to the tape, and shows the matching model underneath.

  • Matches orders by price then time against a live book
  • Demonstrates real order-type semantics, not a mock form
  • Shows the matching model that mirrors a Python engine

Primary interaction

Exchange Engine — Live AI Demo

Operating model

A market, making itself

This is the systems layer under an AI product, shown directly: a working matching engine, not a mock order form. Place an order and watch it match.

01

Quote

A two-sided market drifts live on a timer.

02

Order

Submit a limit or market order, either side.

03

Match

Price-time priority fills against the book.

04

Print

Fills print to the tape; the book updates.

SYMBOL
MID 185.40SPREAD 0.50
Order book
186.90170
186.6569
186.40178
186.1576
185.9035
185.65122
spread 0.50
185.1538
184.9042
184.65154
184.4072
184.15160
183.9075
Order entry
Time and sales
No trades yet. Submit an order above.

Simulates app/exchange/engine.py in the browser. Price-time priority matching with lazy cancel, FOK / IOC / GTC, and live quote drift.

Matching model

The book holds resting orders sorted by price, then by arrival time. An incoming order crosses the spread and fills against the best price first; within a price level, the earliest resting order fills first. That is price-time priority.

  1. Limit order rests in the book if it does not cross, sorted into price-time position.
  2. Market order sweeps the opposite side, taking each best level until filled.
  3. FOK fills completely or cancels; IOC fills what it can and cancels the rest; GTC rests.
  4. Lazy cancel marks an order dead and skips it at match time, avoiding a book rewrite.

Mirrors app/exchange/engine.py. Heap-based price-time priority, no database, no broker. This is the systems layer that sits under an AI product, shown directly.

A real matching engine, not a mock order form.

Matching

Price-time priority

Best price first, then earliest resting order.

Order types

Limit, market, FOK, IOC, GTC

Real semantics, not a single submit button.

Runtime

In-process, no database

Live quote drift on a timer, mirrors a Python engine.

Under the hood

Capability proof

Capability proof

Order matching engine

Service model

A live limit order book a user can submit orders into.

Intelligence layer

Matches by price then time, with limit, market, FOK, IOC, and GTC semantics.

Operational state

Maintains the book, the drifting quote, and the printed trade tape.

Human control

The user places orders and reads fills; nothing executes outside the sandbox.

Business value

Builder proof: shows the systems work under an AI product, not just the prompt.

Architecture

FastAPI auto-loads routers from app/routers/ via pkgutil. New endpoints register by file placement, no manual wiring.

The exchange engine runs as a pure Python in-process matching engine with price-time priority. No database, no broker. The FRED and Polygon clients are thin async wrappers. All AI overlays call GPT-4o-mini with structured prompts that return JSON, not narrative prose.

Deployed on Docker and uvicorn. The shape that matters is the surface, not the deployment.