The discount rate
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.
The NPV of the input cash flow series values
at the discount rate
.
v0.0.18
npv considers a series of cashflows starting in the present (t = 0). NPV can also be defined with a series of future cashflows, paid at the end, rather than the start, of each period. If future cashflows are used, the first cashflow
values[0]` must be zeroed and added to the net
present value of the future cashflows. This is demonstrated in the
examples.
Returns the result of:
\\sum_{t=0}^{M-1}{\\frac{values_t}{(1+rate)^{t}}}
Consider a potential project with an initial investment of $40 000 and projected cashflows of $5 000, $8 000, $12 000 and $30 000 at the end of each period discounted at a rate of 8% per period. To find the project's net present value:
import {npv} from 'financial'
const rate = 0.08
const cashflows = [-40_000, 5000, 8000, 12000, 30000]
npv(rate, cashflows) // 3065.2226681795255
It may be preferable to split the projected cashflow into an initial investment and expected future cashflows. In this case, the value of the initial cashflow is zero and the initial investment is later added to the future cashflows net present value:
const initialCashflow = cashflows[0]
cashflows[0] = 0
npv(rate, cashflows) + initialCashflow // 3065.2226681795255
L. J. Gitman, "Principles of Managerial Finance, Brief," 3rd ed., Addison-Wesley, 2003, pg. 346.
Generated using TypeDoc
Returns the NPV (Net Present Value) of a cash flow series.