DB
Back homeUse case

Market data & trading analytics

Serve the freshest write as the fastest read. One engine holds the tick history, the live order book, and the analytics that price them.

The problem

Why this is hard today

Trading stacks fracture one workflow across systems: a tick store for history, an in-memory cache for current book state, a stream processor for derived signals, and a separate analytics warehouse for backtests. Each hop adds serialization cost, and each copy is a chance for the cache to disagree with the store.

The disagreements surface exactly when they hurt most — at the microsecond boundary where a strategy reads state it just wrote. A stale read against a fresh write is not a rounding error in trading; it is a wrong decision.

What desks actually need is one place where a just-committed tick is immediately visible to the next query, where current state is O(1) to read, and where the counts behind risk are exact rather than sampled.

Architecture

How NYXDB does it

Ticks land in an append table and fan out to keyed current-state tables and continuous transforms through PSI — the shared routing layer — so every derived view stays fresh without a second system.

  1. 01

    Ingest

    Trades append to a WAL-backed table; each write is durable at the group-commit watermark before the client is acked.

  2. 02

    Route (PSI)

    The Predicate Subscription Index delivers each change to the subscribers that match its stream:key — keyed tables, transforms, and live reads.

  3. 03

    Current state

    A keyed table collapses to the latest quote per instrument, so the live book is a point read, not a scan.

  4. 04

    Read

    STREAM SELECT follows the book live; ordinary SELECT and HISTORICAL serve dashboards and backtests off the same data.

Real SQL

In practice

Tick history — append table
CREATE TABLE trades (
id UInt64 NOT NULL,
market String NOT NULL,
amount UInt64 NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO trades (id, market, amount) VALUES
(1, 'BTC-USD', 4120),
(2, 'ETH-USD', 2880);
Live tape — streaming read
STREAM SELECT market, amount
FROM trades
WHERE amount > 1000;
Exact volume by market
SELECT market, count() AS trades, sum(amount) AS volume
FROM trades
GROUP BY market;

Every statement follows the engine’s own test SQL shapes. See the SQL reference for full syntax.

Capabilities

What you get

Keyed current state

Latest quote per instrument in O(1) — no cache to keep in sync with the store.

Exact counts

Deterministic counts and typed aggregates — risk math you can audit, not sample.

Streaming reads

STREAM SELECT follows the book live; the same table serves backtests.

Vectorized scans

Columnar, SIMD-vectorized expression execution for heavy analytics.

One engine

Tick store, cache, and stream processor collapse into one runtime.

Read-your-writes

A just-committed tick is visible to the next query.

Proof

Measured where it counts

~113×

sum(round(amount)): 48.7 → 0.43 ms

ADR-060, general vectorized path

~480–490k

rows/s ingest, end-to-end (local)

ADR-075

µs-classTODO-verify

current-state point reads

placeholder — not yet substantiated

Figures marked TODO-verify are placeholders pending a published, reproducible benchmark; substantiated numbers cite their source.

Build the tape on one engine

Run a node and stream your first market feed in minutes.