Created
December 11, 2017 06:12
-
-
Save frankchen0130/162c1c9ecdbb827179f6813b55ee6367 to your computer and use it in GitHub Desktop.
计算分期还款的实际利率
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculateRealInterest(amount, months, percentPerMonth): | |
interestAmount = amount * percentPerMonth / 100 * months; #总手续费 | |
amountPermonth = amount / months; #每期占用银行金额 | |
occupyMonths = (1 + months) * (months / 2); #总占用月数 | |
occupyYears = occupyMonths / 12; #占用年数 | |
occupyAmountForOneYear = amountPermonth * occupyYears; #相当于占用了一年的金额 | |
realInterest = interestAmount / occupyAmountForOneYear; #实际年化利率 | |
return { | |
'总手续费': interestAmount, | |
'相当于占用了一年的金额': occupyAmountForOneYear, | |
'实际年化利率': realInterest | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment