# Revisions, Vintages, and Point-in-Time Availability

`D00-F03-A09` · Financial Mathematics, Statistics, and Data Foundations → Data, Variables, Samples, and Measurement · archetype `record-transform` · difficulty 1/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/foundations/data-variables-samples-and-measurement/revisions-vintages-and-point-in-time-availability/
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 { revisionsVintagesAndPointInTimeAvailability } from "fintech-algorithms/foundations/data-variables-samples-and-measurement/revisions-vintages-and-point-in-time-availability";
```

## Signature

```ts
revisionsVintagesAndPointInTimeAvailability(input)
```

Picks the value that was genuinely knowable at a given moment by keeping only the vintages published on or before it, which is what stops a backtest reading the future.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | `D00Input` | yes | A plain object. Every F03 topic first reads `rows`, which must be a non-empty array of row objects, and derives the sorted union of every key seen across them before any per-topic branch runs, even though this topic does not use them. The calculation itself reads `asOf`, the cutoff timestamp, and `vintages`, an array of published revisions each carrying an `availableAt` timestamp and a `value`. |

## Returns

`{ asOf: string; value: unknown; vintage: string | null; excludedFutureVintages: number }`

`asOf` echoes the cutoff. `value` and `vintage` come from the latest vintage whose `availableAt` is at or before the cutoff, and are both null when no vintage qualifies. `excludedFutureVintages` counts the revisions dropped for being published after the cutoff.

## Errors

- When input is not a plain object — throws TypeError
- When rows is missing, empty, or not an array — throws RangeError

## Complexity

Time `O(r * c + v log v)`, space `O(r * c + v)`.

## Worked example

This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

### Input

`input`:

```json
{
  "rows": [
    {
      "entity": "A",
      "timestamp": "2025-01-01T00:00:00Z",
      "value": 10,
      "rating": "low"
    },
    {
      "entity": "A",
      "timestamp": "2025-01-02T00:00:00Z",
      "value": null,
      "rating": "medium",
      "censored": true
    },
    {
      "entity": "B",
      "timestamp": "2025-01-01T00:00:00Z",
      "value": 12,
      "rating": "high"
    }
  ],
  "ordinalColumns": ["rating"],
  "populationSize": 100,
  "frameSize": 80,
  "keyColumns": ["entity", "timestamp"],
  "truncationRule": "values below 5 excluded",
  "measurements": [9.9, 10, 10.1, 10],
  "referenceValue": 10,
  "vintages": [
    {
      "availableAt": "2025-02-01T00:00:00Z",
      "value": 100
    },
    {
      "availableAt": "2025-03-01T00:00:00Z",
      "value": 102
    },
    {
      "availableAt": "2025-04-01T00:00:00Z",
      "value": 101
    }
  ],
  "asOf": "2025-03-15T00:00:00Z",
  "provenance": {
    "source": "teaching.csv",
    "owner": "Fintech Builder",
    "license": "CC-BY-4.0",
    "retrievedAt": "2026-08-10",
    "transformations": ["parse", "validate"]
  }
}
```

### Call

```ts
revisionsVintagesAndPointInTimeAvailability(input)
```

### Returns

object with 2 fields: asOf, value

```json
{
  "asOf": "2025-03-15T00:00:00Z",
  "value": 102
}
```

## Verification and provenance

Tier: **verified** (via input-expected).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

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.0.
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/foundations/data-variables-samples-and-measurement/revisions-vintages-and-point-in-time-availability/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/foundations/data-variables-samples-and-measurement/revisions-vintages-and-point-in-time-availability/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/foundations/llms.txt
