fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Time Synchronization

5 algorithms in Market Data Engineering.

In this family#

  1. Previous-Tick Interpolation contract

    Samples a series onto a grid by carrying the last value known *at that moment* forward. The only interpolation that is safe on live data: it never uses a value that had not yet arrived.

    previousTick(observations, requests, maxStalenessMs)
  2. Linear Quote Interpolation contract

    Interpolates between the quotes either side of a target time. More accurate than carrying forward, and **not causal** — it uses a quote from after the target, so it belongs in research and never in a live path.

    linearQuoteInterpolation(quotes, targets, maxGapMs)
  3. Refresh-Time Sampling contract

    Builds a common clock for several instruments by advancing only when every one of them has refreshed. The standard remedy for the bias that non-synchronous trading introduces into correlations.

    refreshTimeSample(observations, requiredInstruments, maxStalenessMs)
  4. Exchange-Calendar Alignment contract

    Validates a trading-calendar bundle before anything is aligned to it: that sessions do not overlap, that closures are consistent with sessions, and that the licence terms permitting redistribution are present.

    validateCalendar(bundle)
  5. Asynchronous Return Alignment contract

    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.

    classifyIntervalPair(left, right)

What they share#

Every topic here is a record-transform</code> or <code>row-classify, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { previousTick } from "fintech-algorithms/market-data-engineering/time-synchronization/previous-tick-interpolation";
import { linearQuoteInterpolation } from "fintech-algorithms/market-data-engineering/time-synchronization/linear-quote-interpolation";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Market Data Engineering collects 31 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.