Order-Book Feed Engineering
7 algorithms in Market Data Engineering.
In this family#
-
Trade-and-Quote Event Normalization contract
Normalises raw venue trade and quote messages into one canonical event shape. Every venue names, orders and timestamps its fields differently; this is the boundary where that stops being everyone else's problem.
normalizeEvents(events) -
Level-2 Snapshot-and-Delta Reconstruction contract
Rebuilds an aggregated price-level book from a snapshot plus the deltas that follow it. Level 2 shows quantity per price, not individual orders — the distinction matters because a delta that is applied twice corrupts the book invisibly.
reconstructL2(snapshot) -
Level-3 Order-by-Order Reconstruction contract
Rebuilds the book order by order rather than by price level. Level 3 preserves queue position, which is the only way to answer where in the queue an order actually sits — and therefore the only basis for a realistic fill model.
reconstructL3(snapshot_orders) -
Sequence-Gap Detection and Recovery contract
Detects missing sequence numbers and decides whether the stream can continue or must resynchronise from a snapshot. A gap is not a nuisance — every message after it is applied to a book that is already wrong.
recoverSequenceStream(arrivals) -
Price-Level Quantity Aggregation contract
Collapses individual orders into quantity per price level — the Level 3 to Level 2 projection, and the form most analytics actually consume.
aggregatePriceLevels(orders) -
Snapshot/Incremental-Feed Reconciliation contract
Reconciles a periodic snapshot against the book built from incrementals. Any divergence means the incremental path has been silently wrong — possibly for hours — and this is the only routine that catches it.
reconcileSnapshotIncrementals(snapshot) -
Multi-Venue Best-Quote and Book Consolidation contract
Merges books from several venues into one consolidated view and identifies the best bid and offer across them. Venue clocks differ, so a naive merge can produce a consolidated book that was never simultaneously true.
consolidateVenues(quotes)
What they share#
Every topic here is a record-transform, so once you have
called one the rest follow the same shape. Import paths differ only in the final segment:
import { normalizeEvents } from "fintech-algorithms/market-data-engineering/order-book-feed-engineering/trade-and-quote-event-normalization";
import { reconstructL2 } from "fintech-algorithms/market-data-engineering/order-book-feed-engineering/level-2-snapshot-and-delta-reconstruction";Read them in the order above — the sequence is pedagogical, not alphabetical.
Where this sits#
Market Data Engineering collects 31 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.