Discount Factors and Discount Rates
Install and import#
npm install fintech-algorithmsimport { discountFactorsAndDiscountRates } from "fintech-algorithms/foundations/financial-arithmetic-time-value-and-returns/discount-factors";Signature#
discountFactorsAndDiscountRates(input)Converts a rate and a horizon into the single multiplier that pulls a future amount back to today, and converts that multiplier back into the per-period rate it implies.
Parameters#
| Name | Type | Notes |
|---|---|---|
input | D00Input | A plain object. Every F02 topic first reads principal, rate and periods and validates them before any per-topic branch runs. This topic uses rate and periods and reads no further keys; principal is validated but not used. |
Returns#
{ discountFactor: number; discountRate: number }
discountFactor is 1 / (1 + rate) ** periods. discountRate is the per-period rate recovered from that factor, and is returned as 0 when periods is 0, since no rate can be inferred over no time.
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#
{
"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#
discountFactorsAndDiscountRates(input)Returns#
object with 2 fields: discountFactor, discountRate
{
"discountFactor": 0.863837598531476,
"discountRate": 0.050000000000000044
}Diagrams#
Calculation flow#
Discount Factors and Discount Rates — four-part map
flowchart LR
A["Name the input"] --> B["Apply: discount factor = 1 / (1 + r)^t; PV = future cash x discount factor"]
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.
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