interest
Interest Theory - Applies interest rate formulas
MIT License. Copyright (c) 2022-2023 Terence Lim
- class actuarialmath.interest.Interest(i: float = -1.0, delta: float = -1.0, d: float = -1.0, v: float = -1.0, i_m: float = -1.0, d_m: float = -1.0, m: int = 0, v_t: Callable[[float], float] | None = None)[source]
Bases:
Actuarial
Store an assumed interest rate, and compute interest rate functions
- Parameters:
i – assumed annual interest rate
d – or annual discount rate
v – or annual discount factor
delta – or continuously compounded interest rate
v_t – or discount rate as a function of time
i_m – or m-thly interest rate
d_m – or m-thly discount rate
m – m’thly frequency, if i_m or d_m are specified
- property i: float
effective annual interest rate
- property d: float
annual discount rate of interest
- property delta: float
continuously compounded interest rate, or force of interest, per year
- property v: float
annual discount factor
- property v_t: Callable
discount factor as a function of time
- annuity(t: int = -1, m: int = 1, due: bool = True) float [source]
Compute value of the annuity certain factor
- Parameters:
t – number of years of payments
m – m’thly frequency of payments (0 for continuous payments)
due – whether annuity due (True) or immediate (False)
Examples
>>> print(interest.annuity(t=10, due=False), 2.831059)
- static mthly(m: int = 0, i: float = -1, d: float = -1, i_m: float = -1, d_m: float = -1) float [source]
Convert to or from m’thly interest rates
- Parameters:
m – m’thly frequency
i – an annual-pay interest rate, to convert to m’thly
d – or annual-pay discount rate, to convert to m’thly
i_m – or m’thly interest rate, to convert to annual pay
d_m – or m’thly discount rate, to convert to annual pay
Examples
>>> i = Interest.mthly(i_m=0.05, m=12) >>> print("Convert mthly to annual-pay:", i) >>> print("Convert annual-pay to mthly:", Interest.mthly(i=i, m=12))
- static double_force(i: float = -1.0, delta: float = -1.0, d: float = -1.0, v: float = -1.0)[source]
Double the force of interest
- Parameters:
i – interest rate to double force of interest
d – or discount rate
v – or discount factor
delta – or continuous rate
- Returns:
interest rate, of same form as input rate, after doubling force of interest
Examples
>>> print("Double force of interest of i =", Interest.double_force(i=0.05)) >>> print("Double force of interest of d =", Interest.double_force(d=0.05))