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

Present Value and Future Value

Install and import#

bash
npm install fintech-algorithms
ts
import { presentValueAndFutureValue } from "fintech-algorithms/foundations/financial-arithmetic-time-value-and-returns/present-future-value";

Signature#

presentValueAndFutureValue(input)

Moves money along the timeline in both directions at once: it compounds principal forward and discounts a supplied futureValue back, over the same number of periods at the same rate.

Parameters#

NameTypeNotes
inputD00InputA plain object. Every F02 topic first reads principal, rate and periods and validates them before any per-topic branch runs. This topic then reads the input key futureValue, the amount to be discounted back to today, coerced with Number.

Returns#

{ futureValue: number; presentValue: number }

The returned futureValue is principal * (1 + rate) ** periods and is computed from principal, not from the input key of the same name. presentValue is the input futureValue divided by (1 + rate) ** periods.

Errors#

  • When input is not a plain object — throws TypeError
  • When principal is negative, periods is negative, or rate is at or below -1 — throws RangeError

Complexity: time O(1), space O(1).

Worked example#

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

Input#

input
{
  "principal": 1000,
  "rate": 0.05,
  "periods": 3,
  "compoundsPerPeriod": 12,
  "futureValue": 1200,
  "cashFlows": [-1000, 400, 400, 400],
  "startValue": 100,
  "endValue": 110,
  "returns": [0.1, -0.05, 0.08],
  "frequency": 12,
  "periodicReturn": 0.01
}

Call#

presentValueAndFutureValue(input)

Returns#

object with 2 fields: futureValue, presentValue

{
  "futureValue": 1157.6250000000002,
  "presentValue": 1036.6051182377712
}

Diagrams#

Present Value and Future Value — concept anatomy
Present Value and Future Value — lesson map
Present Value and Future Value — mistake contrast

Calculation flow#

Present Value and Future Value — four-part map
flowchart LR
    A["Name the input"] --> B["Apply: FV = PV x (1 + r)^t; PV = FV / (1 + r)^t"]
    B --> C["Check units and boundary"]
    C --> D["Explain the output"]

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.

Read the article →

References#

  • CFA_TVM - Time Value of Money in Finance — CFA Institute
  • CFA_QM - CFA Institute Quantitative Methods Study Session — CFA Institute
  • Author-derived and synthetic boundary

The rest of the Financial Arithmetic, Time Value, and Returns family#