Module

x/financial/src/financial.ts>npv

A Zero-dependency TypeScript/JavaScript financial library (based on numpy-financial) for Node.js, Deno and the browser
Latest
function npv
import { npv } from "https://dotland.deno.dev/x/financial@v0.1.3/src/financial.ts";

Returns the NPV (Net Present Value) of a cash flow series.

Parameters

rate: number
  • The discount rate
values: number[]
  • The values of the time series of cash flows. The (fixed) time interval between cash flow "events" must be the same as that for which rate is given (i.e., if rate is per year, then precisely a year is understood to elapse between each cash flow event). By convention, investments or "deposits" are negative, income or "withdrawals" are positive; values must begin with the initial investment, thus values[0] will typically be negative.

Returns

number

The NPV of the input cash flow series values at the discount rate.