Two consumers replay the same ten seconds of market data. If they disagree about what happened, the feed is worthless. Determinism is not a nice-to-have for a data provider — it is the entire value proposition. The hard part is that the inputs are not deterministic at all.
Venues stamp events with their own clocks, and those clocks drift. Worse, the network reorders. So LIAW never trusts wall-clock time as the ordering key. Instead, the core engine builds a canonical order from each source's logical sequence numbers plus a bounded freshness window, then freezes it into the ledger.
- VENUE FEEDSINGRESSWSS · FIX · REST
- // CORECORE_ENGINENORMALIZEDEDUPE · STAMP · TAG
- PROVENANCELEDGER_SYMMETRYHASH · FRESHNESS
Ordering without a trusted clock
The reconciliation is a merge over per-source monotonic sequences. Within a source, sequence is authoritative. Across sources, ties break on observed freshness, and the result is recorded so a replay is bit-for-bit identical.
Determinism is a promise you make to the future: replay this window tomorrow and you will get exactly what you got today.
type SourceEvent = {
venue: string
seq: number
freshnessMs: number
}
// Canonical order: monotonic per-source seq, ties broken on freshness.
export function reconcile(events: SourceEvent[]): SourceEvent[] {
return [...events].sort((a, b) => {
if (a.venue === b.venue) return a.seq - b.seq
return a.freshnessMs - b.freshnessMs
})
}The output is a single canonical sequence per instrument. Every downstream price, candlestick, and source-quality metric is derived from it, which means they all agree by construction. No reconciliation jobs, no nightly fixups — the order is the lineage, and the lineage is the answer.