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

Financial Arithmetic, Time Value, and Returns

10 algorithms in Financial Mathematics, Statistics, and Data Foundations · 10 with asserted arithmetic.

In this family#

  1. Simple Interest verified

    Computes interest that accrues on the original principal only, never on interest already earned, and the balance that leaves at the end.

    simpleInterest(input)
  2. Compound Interest verified

    Grows a principal at a periodic rate applied compoundsPerPeriod times within each period, so earned interest starts earning interest itself.

    compoundInterest(input)
  3. Present Value and Future Value verified

    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.

    presentValueAndFutureValue(input)
  4. Discount Factors and Discount Rates verified

    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.

    discountFactorsAndDiscountRates(input)
  5. Cash-Flow Timelines and Net Present Value verified

    Discounts a dated series of cash flows back to today at a single rate and sums them into a net present value.

    cashFlowTimelinesAndNetPresentValue(input)
  6. Simple Return verified

    Measures the plain percentage gain between a starting and an ending value over one holding period.

    simpleReturn(input)
  7. Log Return verified

    Takes the natural logarithm of the growth ratio between a starting and an ending value, and converts it back to show the two are the same move.

    logReturn(input)
  8. Holding-Period and Cumulative Return verified

    Chains a series of period returns into the single growth factor they compound to, and applies that factor to a starting value.

    holdingPeriodAndCumulativeReturn(input)
  9. Arithmetic versus Geometric Average Return verified

    Averages the same return series two ways, by adding and by compounding, so the gap between the plain mean and the rate actually realised is visible.

    arithmeticVersusGeometricAverageReturn(input)
  10. Return Annualization and Deannualization verified

    Scales a single-period return up to an annual figure by compounding it frequency times, then scales that annual figure back down to confirm the two conversions are inverses.

    returnAnnualizationAndDeannualization(input)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { simpleInterest } from "fintech-algorithms/foundations/financial-arithmetic-time-value-and-returns/simple-interest";
import { compoundInterest } from "fintech-algorithms/foundations/financial-arithmetic-time-value-and-returns/compound-interest";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Financial Mathematics, Statistics, and Data Foundations collects 120 algorithms across 12 families. For the concept behind this family rather than the call signatures, see the concept guides.