我有一个简单的工作年金贷款计算器,用python编写,与在线计算器相比,它给出了正确的结果。也就是说,月度金额(什么部分是利息,什么是首期付款金额等)和实际利率(EIR)。它使用两个numpy函数, ppmt 和 ipmt
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!
答案 0 :(得分:0)
尝试此操作(使用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)