fintech-algorithms

Feed-Latency Monitor

Install and import

bash
npm install fintech-algorithms
ts
import { validateClockProfile } from "fintech-algorithms/market-data-engineering/data-quality/feed-latency-monitor";

Signature

validateClockProfile(profile)

Validates that a latency measurement is meaningful before any latency is computed from it. Subtracting timestamps written by two unsynchronised clocks produces a number, and that number means nothing.

Parameters

NameTypeNotes
profileClockProfileWhich clock domain owns each timestamp, who wrote it, the cross-domain synchronisation status, and the maximum absolute offset between domains.

Returns

{ …profile, status, usable_measurements, warnings }

The profile echoed back with a verdict on which latency measurements it can support and which would be meaningless.

Errors

  • When a clock domain or timestamp owner is missing — throws

Complexity: time O(1), space O(1).

Worked example

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input

profile
{
  "source_clock_domain": "SYNTHETIC-VENUE-UTC",
  "ingress_clock_domain": "CONSUMER-PHC-UTC",
  "ready_clock_domain": "CONSUMER-PHC-UTC",
  "source_timestamp_owner": "synthetic venue encoder",
  "ingress_timestamp_owner": "consumer NIC hardware capture",
  "ready_timestamp_owner": "consumer feed-handler process",
  "cross_domain_sync_status": "synchronized",
  "max_abs_offset_ms": 0.05,
  "measured_at": "2026-07-13T13:29:59Z",
  "evidence": "synthetic declared bound; not a production clock attestation"
}

Call

validateClockProfile(profile)

Returns

object with 10 fields: source_clock_domain, ingress_clock_domain, ready_clock_domain, source_timestamp_owner, ingress_timestamp_owner, ready_timestamp_owner, cross_domain_sync_status, max_abs_offset_ms, …

{
  "source_clock_domain": "SYNTHETIC-VENUE-UTC",
  "ingress_clock_domain": "CONSUMER-PHC-UTC",
  "ready_clock_domain": "CONSUMER-PHC-UTC",
  "source_timestamp_owner": "synthetic venue encoder",
  "ingress_timestamp_owner": "consumer NIC hardware capture",
  "ready_timestamp_owner": "consumer feed-handler process",
  "cross_domain_sync_status": "synchronized",
  "max_abs_offset_ms": 0.05,
  "measured_at": "2026-07-13T13:29:59Z",
  "evidence": "synthetic declared bound; not a production clock attestation"
}

Other exports

This module also exports percentile, diagnoseEvent, monitor. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams

Feed-Latency Monitor — article hero
Feed-Latency Monitor — latency budget

How it works

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References