Skip to content
Pre-release, heavy development. Reef is already runnable, but APIs, schemas, and game mechanics still change - see Current Status.

Reef

A hands-on market-infrastructure lab: submit orders, watch them match, replay what happened, and follow trades into settlement.

Reef is built to make market plumbing visible. Orders go through a real command boundary, hit a hidden-book matching engine, produce trades, then leave evidence you can inspect and replay. The platform is shaped like serious infrastructure, but it stays local-first so you can run it, break it, and understand it from end to end.

Kotlin runtimeGo matching engineRedpanda direct streamPostgresProtobuf contractsSettlement facts: first sliceBot Arena: WIP

Project Overview

The short version: what Reef is, who it is for, and why simulation drives the same command path as real users. Start at What Is Reef.

Bot Arena & Bot SDK

The trading-bot game taking shape on top of the venue. Author a bot, run seeded matches, and keep every result replayable. Start at Arena Overview.

Trading API

The public surface for submitting orders, reading market data, checking command status, and inspecting settlement evidence. Start at API Overview.

Data Schema

Where Reef keeps durable facts, rebuildable projections, auth/admin policy, and wire contracts. Start at Schema Overview.

Two layers, one command path. The core platform owns the business behavior: order intake, matching, trades, settlement evidence, and audit trails. The simulation control plane supplies scripted scenarios, participant bots, seeded randomness, and Bot Arena runs. Both layers use the same public commands, so a replayed scenario and a manual user leave comparable evidence.

durable order intake -> hidden-book matching engine -> venue event batches
-> canonical facts & projections -> settlement facts
-> ledger proof -> audit trail

Read The Architecture

How the runtime, matching engine, simulator, stock-data service, and schema boundaries fit together. See Architecture.

Bots are TypeScript classes extending ReefBotV1. The harness handles ticks, validation, and risk checks; your bot reads the market snapshot and chooses what orders to place.

export default class ExampleBot extends ReefBotV1 {
static override metadata = {
name: "example-bot",
publisher: "Example Publisher",
email: "bot-author@example.com",
version: "1.0.0",
sdkVersion: "1.5.0",
botApiVersion: "v1",
} as const;
override async onTick(ctx: BotContextV1) {
const snapshot = await ctx.marketData.snapshot("AAPL");
if (!snapshot.ok) return [];
return [
ctx.orders.placeLimit({
instrumentId: "AAPL",
side: "BUY",
quantity: 10,
limitPrice: snapshot.value.midPrice - 1,
}),
];
}
}

Write your first bot

Build a bot, run it locally, and see what the harness accepts or rejects. See Bot SDK Quickstart.

Terminal window
make dev-up # start Postgres, runtime, matching engine
make dev-smoke # verify the local stack end to end
make dev-sim # drive a seeded scenario