Order-Book Feed Engineering
7 algorithms in Market Data Engineering · 7 with asserted arithmetic.
In this family#
-
Trade-and-Quote Event Normalization verified
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 verified
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 verified
Rebuilds the book order by order rather than by price level, so each visible order keeps its own identity and quantity through add, reduce, execute, delete, and replace. The emitted
priority_rankis the insertion order of visible identities within the reconstructed stream. It is not a venue queue position and carries no information about hidden liquidity, participant identity, or exchange-internal priority changes that the feed does not report.reconstructL3(snapshot_orders) -
Sequence-Gap Detection and Recovery verified
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 verified
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 verified
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 verified
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.