Module 2 · Financial Arithmetic, Time Value, and Returns Lesson 18 of 120

Holding-Period and Cumulative Return

A two-period performance report with changing bases.

2:43 clip55:45–58:28 in the full courseWatch on YouTube

Transcript

22 sentences · select one to jump there

Check your understanding

What gain is needed to recover from 96 to 100?

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.

018-holding-period-and-cumulative-return.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 018 of 120
 * Holding-Period and Cumulative Return
 * Module 02: Financial Arithmetic, Time Value, and Returns
 *
 * Scenario: A two-period performance report with changing bases
 * Rule:     cumulative = Π(1+Rₜ) − 1
 *
 * Try it:   What gain is needed to recover from 96 to 100?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/financial-arithmetic-time-value-and-returns/holding-period-return/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson018() {
  const returns = [0.20, -0.20];
  let wealth = 100;
  const path = [wealth];
  for (const r of returns) {
    if (!(1 + r > 0)) throw new Error("Growth factor must be positive");
    wealth *= 1 + r; path.push(wealth);
  }
  const result = {path, cumulative: wealth / path[0] - 1};
  return result;
}

export const checkedResult = {"path":[100,120,96],"cumulative":-0.040000000000000036};

// Run this file directly: npx tsx lessons/02-financial-arithmetic-time-value-and-returns/018-holding-period-and-cumulative-return.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson018(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "path": [
    100,
    120,
    96
  ],
  "cumulative": -0.040000000000000036
}

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

Lesson notes

The rule

cumulative = Π(1+Rₜ) − 1