Asynchronous Return Alignment
Install and import
npm install fintech-algorithmsimport { classifyIntervalPair } from "fintech-algorithms/market-data-engineering/time-synchronization/asynchronous-return-alignment";Signature
classifyIntervalPair(left, right)Compares two return intervals and reports exactly how they overlap. Correlating returns measured over intervals that only partly coincide is a quiet and common source of wrong numbers.
Parameters
| Name | Type | Notes |
|---|---|---|
left | ReturnInterval | First return, carrying event_start, event_end, available_at and return_value. |
right | ReturnInterval | Second return, in the same shape. |
Returns
{ geometry, event_overlap_start, event_overlap_end, event_overlap_ms, left_overlap_fraction, right_overlap_fraction, … }
The overlap geometry — disjoint, partial, nested or identical — with the overlapping window and what fraction of each interval it represents.
Errors
- When an interval ends before it starts — 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
{
"return_id": "L1",
"instrument": "L",
"partition": "S",
"event_start": "2026-01-01T00:00:00.000Z",
"event_end": "2026-01-01T00:00:04.000Z",
"available_at": "2026-01-01T00:00:04.000Z",
"return_value": 0.01
}{
"return_id": "R1",
"instrument": "R",
"partition": "S",
"event_start": "2026-01-01T00:00:00.000Z",
"event_end": "2026-01-01T00:00:04.000Z",
"available_at": "2026-01-01T00:00:04.000Z",
"return_value": 0.01
}Call
classifyIntervalPair(left, right)Returns
object with 11 fields: left_return_id, right_return_id, partition, geometry, event_overlap_start, event_overlap_end, event_overlap_ms, left_overlap_fraction, …
{
"left_return_id": "L1",
"right_return_id": "R1",
"partition": "S",
"geometry": "exact",
"event_overlap_start": "2026-01-01T00:00:00.000Z",
"event_overlap_end": "2026-01-01T00:00:04.000Z",
"event_overlap_ms": 4000,
"left_overlap_fraction": 1,
"right_overlap_fraction": 1,
"pair_available_at": "2026-01-01T00:00:04.000Z",
"jointly_available_at_evaluation": null
}Other exports
This module also exports
diagnoseAsynchronousReturnAlignment. 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
Calculation flow
Diagnostic interval-overlap flow
flowchart LR
A["Correction-resolved returns"] --> B["Validate identity, time, and partition"]
B --> C["Compare same-partition event intervals"]
C --> D["Classify geometry and coverage"]
D --> E["Evaluate pair availability"]
E --> F["Emit diagnostic only"]
F -. "separate specification" .-> G["Optional downstream estimator"]
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.
References
- On covariance estimation of non-synchronously observed diffusion processes — Takaki Hayashi and Nakahiro Yoshida
- RFC 3339: Date and Time on the Internet: Timestamps — Internet Engineering Task Force; Graham Klyne and Chris Newman
- Evidence classification