# Feed-Latency Monitor

`D01-F04-A02` · Market Data Engineering → Data Quality · archetype `row-classify` · difficulty 2/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/market-data-engineering/data-quality/feed-latency-monitor/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

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

## Signature

```ts
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

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `profile` | `ClockProfile` | yes | Which 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

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`:

```json
{
  "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

```ts
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, …

```json
{
  "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

`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.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/market-data-engineering/data-quality/feed-latency-monitor/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-data-engineering/data-quality/feed-latency-monitor/impl.ts
- Standalone repository: https://github.com/IslamBaraka90/Fintech-Feed-Latency-Monitor-Data-Quality-algorithm
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-data-engineering/llms.txt
