Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@chewhx/financejs

chewhx21MIT1.0.0TypeScript support: included

--- packageName: finance-js ---

finance, javascript, futurevalue, presentvalue, amortization, dcf, irr

readme


packageName: finance-js

finance-js

Installation

Present Value

import { presentValue } from '%packageName%';

Examples

Present value of $10,000, annual rate of 5%, 4 years from now

presentValue({
    annualRate: 0.05,
    years: 4,
    futureValue: 10_000,
    precision: 2,
});

Present value of $10,000, annual rate of 5%, accrued monthly, 4 years from now

presentValue({
    annualRate: 0.05,
    years: 4,
    futureValue: 10_000,
    precision: 2,
    frequency: 'monthly',
});

Parameters

{
    /** Interest rate per annual in decimals, between 0 - 1*/
    annualRate: number;

    /** Current value of the asset */
    futureValue: number;

    /** Number of years */
    years: number;

    /** Interest compounding frequency per year*/
    frequency?: TFrequency;

    /** Decimal places to return */
    precision?: number;
};

Future Value

Examples