def ppmt(rate, per, nper, pv, fv=0.0, when='end'): """ Not implemented. Compute the payment against loan principal. Parameters ---------- rate : array_like Rate of interest (per period) per : array_like, int Amount paid against the loan changes. The `per` is the period of interest. nper : array_like Number of compounding periods pv : array_like Present value fv : array_like, optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0)) See Also -------- pmt, pv, ipmt """ m = pmt(rate, nper, pv, fv, when) if per == 1: return m else: return m - ipmt(rate, per, nper, pv, fv, when)
def loanCalcs(price, percentDown, closingCosts, repairCosts, rate, term): downPayment = price * percentDown cashToClose = downPayment + closingCosts cashToOperate = cashToClose + repairCosts pv = price - downPayment nper = term payment = -pmt(rate, nper, pv)/12 return payment, downPayment, cashToClose, cashToOperate
def ipmt(rate, per, nper, pv, fv=0.0, when='end'): """ Not implemented. Compute the payment portion for loan interest. Parameters ---------- rate : scalar or array_like of shape(M, ) Rate of interest as decimal (not per cent) per period per : scalar or array_like of shape(M, ) Interest paid against the loan changes during the life or the loan. The `per` is the payment period to calculate the interest amount. nper : scalar or array_like of shape(M, ) Number of compounding periods pv : scalar or array_like of shape(M, ) Present value fv : scalar or array_like of shape(M, ), optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)). Defaults to {'end', 0}. Returns ------- out : ndarray Interest portion of payment. If all input is scalar, returns a scalar float. If any input is array_like, returns interest payment for each input element. If multiple inputs are array_like, they all must have the same shape. See Also -------- ppmt, pmt, pv Notes ----- The total payment is made up of payment against principal plus interest. ``pmt = ppmt + ipmt`` Gnumeric and KSpread disagree vs. Excel and OO for ipmt(.05/12,100,360,100000,0,1) Need to derive the results and state assumptions. """ m = pmt(rate, nper, pv, fv, when) when = _convert_when(when) return -(rate * (pv + when * m) * (1 + rate)**(per - 1 - when) + m * ((1 + rate)**(per - 1 - when) - 1))
def ipmt(rate, per, nper, pv, fv=0.0, when='end'): """ Not implemented. Compute the payment portion for loan interest. Parameters ---------- rate : scalar or array_like of shape(M, ) Rate of interest as decimal (not per cent) per period per : scalar or array_like of shape(M, ) Interest paid against the loan changes during the life or the loan. The `per` is the payment period to calculate the interest amount. nper : scalar or array_like of shape(M, ) Number of compounding periods pv : scalar or array_like of shape(M, ) Present value fv : scalar or array_like of shape(M, ), optional Future value when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)). Defaults to {'end', 0}. Returns ------- out : ndarray Interest portion of payment. If all input is scalar, returns a scalar float. If any input is array_like, returns interest payment for each input element. If multiple inputs are array_like, they all must have the same shape. See Also -------- ppmt, pmt, pv Notes ----- The total payment is made up of payment against principal plus interest. ``pmt = ppmt + ipmt`` Gnumeric and KSpread disagree vs. Excel and OO for ipmt(.05/12,100,360,100000,0,1) Need to derive the results and state assumptions. """ m = pmt(rate, nper, pv, fv, when) when = _convert_when(when) return -(rate*(pv+when*m)*(1+rate)**(per-1-when) + m*((1+rate)**(per-1-when)-1))
def PMT(NPER, IPER, PV, FV): return np.pmt(IPER, NPER, PV, FV, 0)
import numpy.lib.financial as fin # signature of fv fucntion is (Rate,nper(number of years),pmnt (payment),pv(present value), when='end' ) # the following is for rate = %10, one year, 0 payment and $100 principle futVal_1 = fin.fv(0.1,1,0,100) help(fin.fv) futVal_2 = fin.fv(0.1,5,0,100) ''' Here is an example. John is planning to buy a used car with a price tag of $5,000. Assume that he would pay $1,000 as the down payment and borrow the rest. The annual interest rate for a car load is 1.9% compounded monthly. What is his monthly payment if he plans to retire his load in three years? We could calculate the monthly payment manually; see the following code: ''' # manual calculation r=0.019/12 pv=4000 n=3*12 pymnt = pv*r/(1-1/(1+r)**n) pymntPermonth = 200 # Using scipy sp.pmt(r,n,pv) sp.rate(n,pymntPermonth,-pv,0) round(sp.nper(r,-pymntPermonth,-pv,0)) fin.pmt(r,n,pv) fin.rate(n,pymntPermonth,-pv,0)