---
id: "order-book-matcher"
type: "component"
kind: "matching-engine"
provider: "default"
category: "compute"
docs: "https://en.wikipedia.org/wiki/Order_matching_system"
url: "https://localhost:3000/catalogue/components/order-book-matcher"
---

# Order-book matcher

Generic single-threaded, deterministic price-time order matching engine.

| | |
|---|---|
| Provider | [default](https://localhost:3000/catalogue?provider=default) |
| Kind | [Matching engine](https://localhost:3000/catalogue/kinds/matching-engine) |
| Category | Compute |
| Official docs | [https://en.wikipedia.org/wiki/Order_matching_system](https://en.wikipedia.org/wiki/Order_matching_system) |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `algorithm` | enum | `price-time`, `pro-rata` | no | "price-time" | **"price-time"** |
| `deterministic` | boolean | — | no | true | **true** |
| `failover` | enum | `none`, `manual`, `automatic` | no | "none" | **"none"** |
| `managed` | boolean | — | no | false | inherited |
| `replayFromJournal` | boolean | — | no | false | inherited |
| `role` | enum | `primary`, `standby` | no | "primary" | **"primary"** |
| `singleThreaded` | boolean | — | no | true | **true** |

Bold values are the ones this component pins.

## Rules that apply · 2

### Stateful engine pinned to a single zone `stateful-engine-pinned-to-single-zone` (error)

- Page: https://localhost:3000/catalogue/rules/stateful-engine-pinned-to-single-zone.md
- Why: A matching engine, coordination service or event store living in exactly one availability zone, with no failover and no replication, is lost with that zone. Everything that depends on it stops with it.
- Applies to: every node of kind matching-engine, coordination-service or event-store
- Message: '{{node.id}}' is pinned to a single availability zone with no failover or replication.

It fires when:

- all of these hold:
  - the node sits inside exactly 1 availability-zone group
  - any of these hold:
    - the node's `failover` is "none"
    - the node's `replicated` is false
    - the node's `replication` is "none"

### Stateful node without zone redundancy `stateful-node-without-zone-redundancy` (error)

- Page: https://localhost:3000/catalogue/rules/stateful-node-without-zone-redundancy.md
- Why: A stateful compute node pinned to exactly one availability zone disappears with that zone, and its state goes with it. Nodes inside a cell are exempt, because there the cell is deliberately single-zone and redundancy comes from the other cells.
- Applies to: every node in category compute
- Message: Stateful node '{{node.id}}' lives in exactly one availability zone. A zone outage takes its state with it.

It fires when:

- all of these hold:
  - the node's `stateless` is false
  - the node sits inside exactly 1 availability-zone group
  - this does not hold:
    - the node sits inside at least one cell group

## Other products of the same kind · 2

- [Amazon GameLift FlexMatch](https://localhost:3000/catalogue/components/aws-gamelift-flexmatch.md) `aws-gamelift-flexmatch` — aws
- [Generic matching engine](https://localhost:3000/catalogue/components/matching-engine.md) `matching-engine` — default

## Use it in a design

```yaml
nodes:
  - { id: "order-book-matcher", component: "order-book-matcher" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# Generic in-house order-book matching engine: single-threaded, deterministic price-time matcher fed
# by a sequencer; replaying the journal to rebuild state is opt-in.
schemaVersion: "1"
type: "component"
id: "order-book-matcher"
kind: "matching-engine"
provider: "default"
docs: "https://en.wikipedia.org/wiki/Order_matching_system"
defaults:
  singleThreaded: true
  deterministic: true
  algorithm: "price-time"
  role: "primary"
  failover: "none"
properties:
  replayFromJournal:
    type: "boolean"
    default: false
```

Human page: https://localhost:3000/catalogue/components/order-book-matcher
