Giter Club home page Giter Club logo

mort_calc's Introduction

mortgage_calc

www.pathf.com/blogs/2010/02/mortcalc-gem/

Calculates mortgage APR, monthly payments, and fees.

INSTALL

$ sudo gem install gemcutter
$ gem tumble
$ sudo gem install mortgage_calc

or add the following to your environment.rb

config.gem 'mortgage_calc'

Example:

loan_amount = 350000
interest_rate = 4.75
period = 30 * 12
lender_fee = 800
points = 1.0

mort_calc = MortgageCalc::MortgageUtil.new(loan_amount, interest_rate, period, lender_fee, points)

mort_calc.apr
mort_calc.monthly_payment
mort_calc.monthly_payment_with_fees
mort_calc.total_fees

Formulas used

Monthly payment with fees

P = [(C + E) r (1 + r)^N]/[(1 + r)^N - 1]

P = monthly payment
C = Loan amount
r = Interest rate
N = Period in months
E = Lender fees

Monthly payment without fees is calculated like above with E = 0.

APR

[a (1 + a)^N] / [(1 + a)^N - 1] - P/C = 0
a = A/1200
N = Period in months
P = Monthly payment
C = Loan amount

Total fees

Total fees are calculated simply by adding Lender fees to the points paid by borrower.

T = E + P(C)

mort_calc's People

Contributors

perryqh avatar

Stargazers

 avatar Rod Dutra avatar Tony Zhou avatar Angus H. avatar  avatar Kedar Mhaswade avatar Kirk A. Howard avatar Ben Carpenter avatar Jonathan Towell avatar

Watchers

 avatar James Cloos 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.