Git Product home page Git Product logo

mortgage's Introduction

Mortgage

This project was created to help evaluate the cost of various mortgages. The mortgage classes in mortgage.py are from John Guttag's excellent book Introduction to Computation and Programing using Python. The avalance.py file contains a host of helper functions used to simulate and evaluate various mortgages based on the Mortgage objects in the mortgage.py file.

It should be noted that this simulation will potentially overpay a final payments. This overpayment can present some confusing end results (e.g. the total sum paid across multiple mortgages will be divisible by the budget amount).

Other Uses

The loans are all fairly generic, this can be used for mortgages, but also car payments, or student loans.

Running the simulation

A simple simulation can be performed as follows:

budget = 1000
ex = Fixed(loan=110000.0, r=.0375, months=360)
while ex.loan_complete() == False:
    amt = budget - ex.payment
    ex.makePayment(amt)

A comparison of loans can be performed as follows:

loan1 = Fixed(loan=25000.0, r=0.03, months=60)
loan2 = Fixed(loan=2000.0, r=0.24, months=12)

loan_list = [loan1,loan2]
budget = 1000

# avalanche using select_loan_rate
ava = avalanche(loan_list_a,budget,select_loan_rate)
avalanche_summary(ava)
print('Total Payments\t\tInterest Paid')
print(totals(ava))

Two Approaches

The avalanche function can take two methods for selecting which loan to pay-off, keeping in mind that the loan will be paid off in its entirety before the algorithm chooses another loan. Examples as follows:

select_loan_rate

ava = avalanche(loan_list_a,budget,select_loan_rate)
avalanche_summary(ava)

select_loan_pmt

int_pmt = avalanche(loan_list_b,budget,select_loan_pmt)
avalanche_summary(int_pmt)

mortgage's People

Contributors

faraday1221 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.