numpy_financial.rate#
- numpy_financial.rate(nper, pmt, pv, fv, when: str | int | NDArray[Any] | Iterable[str | int] = 'end', guess: float | Decimal | None = None, tol: float | Decimal | None = None, maxiter: int = 100, *, raise_exceptions: bool = False) Any#
Compute the rate of interest per period.
- Parameters:
- nperarray_like
Number of compounding periods
- pmtarray_like
Payment
- pvarray_like
Present value
- fvarray_like
Future value
- when{{‘begin’, 1}, {‘end’, 0}}, {string, int}, optional
When payments are due (‘begin’ (1) or ‘end’ (0))
- guessNumber, optional
Starting guess for solving the rate of interest, default 0.1
- tolNumber, optional
Required tolerance for the solution, default 1e-6
- maxiterint, optional
Maximum iterations in finding the solution
- raise_exceptions: bool, optional
Flag to raise an exception when at least one of the rates cannot be computed due to having reached the maximum number of iterations (IterationsExceededException). Set to False as default, thus returning NaNs for those rates.
Notes
The rate of interest is computed by iteratively solving the (non-linear) equation:
fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) = 0
for
rate.References
Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula OpenDocument-formula-20090508.odt