Financial functions
The luego.finance package contains basic financial functions.
luego.finance
cumulativeRateBands
Given a list of rate bands, this function returns a function: Number => Number, that given a monetary amount applies the cumulative rates.
futureValueAtEnd
Returns the future value of an investment, given the periodic interest rate r, the number of periods nper, the payment made each period c (a negative number) and the present value of future payments pv (a negative number)
mortgageMonthlyPayment
Calculates the monthly payment of a mortgage as a Number given a principal p, a yearly rate r and a term in years t
mortgageMonthlyPaymentBD
Calculates the monthly payment of a mortgage as a BigDecimal given a principal p, a yearly rate r and a term in years t
npv
Calculates the Net Present Value of a principal amount given a discount rate r and a sequence of cash flows. If the amounts represent an income then the value should be positive, else if they are payments, the value should be negative.
positivePiecewiseConstant
Given a list of intervals with an associated constant value (represented as a list of pair of numbers), this function returns a function: Number => Number, that given a numeric amount returns the constant value for the corresponding interval.
projectFixedRateGrowth
Project initial value v0 at a fixed growth rate r during n periods
projectVarRateGrowth
Projects initial value v0 at a variable growth rate represented by the list of numbers rates