用月费计算正确的实际利率

Computing the correct effective interest rate with monthly fees

我有一个用 python 编写的简单工作年金贷款计算器,与在线计算器相比,它给出了正确的结果。即每月金额(利息是多少,首付金额是多少等)和实际利率(EIR)。它使用两个 numpy 函数,ppmtipmt

loanAmount       = 100000
monthlyIntRate   = 2.5 / 12
effectiveIntRate = 100 * ((1 + monthlyIntRate/100.)**12 - 1)

但是,当我在付款中加上月费时,我的 EIR 发生了变化,但不再等于在线贷款计算器给出的答案。

monthlyFee   = -5
monthlyIntToBePaid = np.ipmt(rate, per, nPer, loanAmount)
monthDownPay = np.ppmt(rate, per, nPer, loanAmount)
amountDue    = monthlyInt + monthDownPay + monthlyFee

其他一切,仍然完全一致。我认为我的公式是一个不错的近似值,但我想知道更好的方法!

effectiveIntRate  = 100 * ((1+ monthlyIntRate/100.)**12 - 1)
effectiveIntRate += 100 * monthlyFee*12*2./loanAmount   # <-- this line!

试试这个(使用 IRR 计算费用后的利率):

nPer=12
rate=monthlyIntRate/100.
Monthpay=np.pmt(rate, nPer, loanAmount, fv=0)
amountDue  = Monthpay + monthlyFee

effectiveIntRate  = 100 * ((1+ monthlyIntRate/100.)**12 - 1)
#effectiveIntRate += 100 * monthlyFee*12*2./loanAmount   # <-- this line!

monthpays = [-amountDue] * nPer

monthpaysf=[-loanAmount] + monthpays


efratem=np.irr(monthpaysf)

effectiveIntRateF = 100 * ((1 + efratem)**12 - 1)

print(efratem*100,effectiveIntRateF)

(0.21749271256861213, 2.6413600327578557)