Module 3 · Data, Variables, Samples, and Measurement Lesson 29 of 120

Revisions, Vintages, and Point-in-Time Availability

Backtesting with the version that actually existed.

2:35 clip1:29:37–1:32:13 in the full courseWatch on YouTube

Transcript

20 sentences · select one to jump there

Check your understanding

Which value belongs in the time-three replay?

Choose one answer

Code lab

Run it yourself

The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.

029-revisions-vintages-and-point-in-time-availability.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 029 of 120
 * Revisions, Vintages, and Point-in-Time Availability
 * Module 03: Data, Variables, Samples, and Measurement
 *
 * Scenario: Backtesting with the version that actually existed
 * Rule:     availableAt ≤ decisionTime
 *
 * Try it:   Which value belongs in the time-three replay?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/revisions-vintages-and-point-in-time-availability/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson029() {
  const versions = [
   {value: 110, availableAt: 5},
   {value: 100, availableAt: 1}
  ];
  const decisionTime = 3;
  const eligible = versions.filter(v => v.availableAt <= decisionTime);
  const latest = eligible.reduce<typeof versions[number] | null>(
    (best, v) => best === null || v.availableAt > best.availableAt ? v : best, null);
  const result = latest?.value ?? null;
  return result;
}

export const checkedResult = 100;

// Run this file directly: npx tsx lessons/03-data-variables-samples-and-measurement/029-revisions-vintages-and-point-in-time-availability.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson029(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

100

Prefer your own machine? Every file is in the course repository · open it in Codespaces.

Lesson notes

The rule

availableAt ≤ decisionTime