Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extra_principle_payments for monthly_payment_schedule #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bowzoo
Copy link

@bowzoo bowzoo commented Feb 23, 2017

No description provided.

@alextz
Copy link

alextz commented Jan 31, 2022

I must deal with unexpected extra principle payments during the life of a loan, so simply instantiated a new Mortgage when a payment has extra principle using this:

m is the current Mortgage

m = mortgage.Mortgage(rate, m.loan_months() - 1, max(0, m.amount() - list(m.monthly_payment_schedule())[0][0] - extra_principle_payment), payment = m.monthly_payment())

And, the __init__ for Mortgage allows setting the monthly payment like this:

    def __init__(self, interest, months, amount, payment = None):
        self._interest = float(interest)  
        self._months = max(1, int(months))
        self._amount = dollar(amount)
        if  not payment :                              
            payment     = float(self.amount()) * self.rate() / (float(MONTHS_IN_YEAR) * (1.-(1./self.month_growth()) ** self.loan_months()))                                                                       
        self._payment   = dollar(payment, round=decimal.ROUND_CEILING)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants