Package com.quantfinlib.marketdata
package com.quantfinlib.marketdata
Market data transport, two lanes:
HFT lane — HftMarketDataBus
over TickRingBuffer (lock-free SPSC,
padded sequences, zero allocation; measured p50 ≈ 204 ns
publish-to-strategy) with SymbolRegistry
interning symbols to dense int ids.
Convenience lane —
MarketDataProcessor (object events,
String symbols, multi-portfolio mark-to-market) for research and
monitoring where nanoseconds don't matter.
-
ClassDescriptionUltra-low-latency market data bus.In-memory historical market data store keyed by symbol.ITCH 5.0-style binary market-data codec: the message subset that drives a full-depth (L3) book — add, add-with-attribution, execute, cancel, delete, replace, and off-book trade — with the exact field layout and big-endian encoding of the Nasdaq TotalView-ITCH 5.0 specification.Mutable flyweight over one message in a caller-owned buffer.Participant-side full-depth (L3) book builder: reconstructs a venue's book from an ITCH-style event stream (add / execute / cancel / delete / replace) and answers the questions an execution engine actually asks — best bid/ask, depth, and exactly how many shares are queued ahead of my order — with zero allocation on every event.A tick / trade print.Callback for market data events.Real-Time Market Data Processing pipeline.National Best Bid and Offer: aggregates per-venue top-of-book quotes for one symbol into the consolidated best bid/ask, the size available at those prices, and a bitmask of which venues are at the inside — the three inputs a smart order router actually consumes.Fired after the NBBO (price or inside size) changes.RingBuffer<E>Bounded lock-free single-producer / single-consumer ring buffer for ultra-low-latency event passing: no locks, no allocation on the hot path, power-of-two indexing.Interns instrument symbols to dense int ids so the hot path never touches
Stringhashing or map lookups: resolve the id once at subscription time, then publish and dispatch with primitive ints only.All-primitive tick callback for the HFT hot path: no event object, no boxing, no allocation.Zero-allocation single-producer / single-consumer ring buffer for market data ticks, in the style of the LMAX Disruptor: Preallocated primitive slots — ticks live in parallelint[]/double[]/long[]arrays; nothing is allocated per tick on either side, so the steady-state GC load is zero. Cache-line-padded sequences — head and tail counters are padded to avoid false sharing between the producer and consumer cores. Acquire/release ordering — slot writes are published with a single release store of the tail; no CAS, no locks on the hot path. Sequence caching — each side caches the other's sequence and only re-reads the volatile counter when it appears blocked, removing most cross-core traffic.