Beispiel #1
0
def main():
    ## Calculate the monthly payment for a mortgage.
    principal = float(input("Enter principal of mortgage: "))
    interestRate = float(input("Enter percent interest rate: "))
    term = float(input("Enter duration of mortgage in years: "))
    mort = mortgage.Mortgage(principal, interestRate, term)
    print("Monthly payment: ${0:,.2f}".format(mort.calculateMonthlyPayment()))
Beispiel #2
0
 def get_monthly_mortgage(self, interest, amount, months, property_tax_rate):
 	try:
 		amount = int(amount)
 		m = mortgage.Mortgage(interest=interest, amount=amount, months=months)
 		base_monthly_payment = m.monthly_payment()
 		insurance = amount/1000*3.5/12
 		taxes = amount * property_tax_rate / 12
 		monthly_payment = base_monthly_payment + insurance + taxes
 		self.monthly_mortgage = monthly_payment
 	except:
 		pass
Beispiel #3
0
 def __init__(self, price, down_percent, interest, years, closing, taxes, appreciation, insurance, selling_cost, rent, value):
     self._price = float(price)
     self._down = float(price*down_percent)
     self._closing = float(closing)
     self._taxes = float(taxes/12)
     self._appreciation = float(appreciation)/12.0
     self._rent = rent
     self._mortgage = mortgage.Mortgage(interest, years, price-self._down)
     self._current_value = float(value)
     self._tax_appraisal = float(value)
     self._insurance = float(insurance/12)
     self._selling_cost = selling_cost
     self._sell_profit = 0
     self._equity = self._down
Beispiel #4
0
def financing_assumptions(equity_per, seller_carry_per, interest_rate,
                          amort_period, seller_carry_rate, seller_carry_term):
    global m, total_purchase, ask, improvements_cost, owners_equity_percent, seller_financing_percent, owners_equity_value, seller_financing_value, financing_amount, interest_rate_yearly, interest_rate_monthly, amort_period_yearly, amort_period_monthly, payment_monthly, payment_annual, seller_financing_rate, seller_financing_term
    total_purchase = ask - improvements_cost
    owners_equity_percent = equity_per
    seller_financing_percent = seller_carry_per
    owners_equity_value = total_purchase * owners_equity_percent
    seller_financing_value = total_purchase * seller_carry_per
    financing_amount = total_purchase - (owners_equity_value +
                                         seller_financing_value)
    interest_rate_yearly = interest_rate
    interest_rate_monthly = interest_rate_yearly / 12
    amort_period_yearly = amort_period
    amort_period_monthly = amort_period_yearly * 12
    m = mortgage.Mortgage(interest=(interest_rate_yearly / 100),
                          amount=financing_amount,
                          months=amort_period_monthly)
    payment_monthly = m.monthly_payment()
    payment_annual = payment_monthly * 12
    seller_financing_rate = seller_carry_rate
    seller_financing_term = seller_carry_term
Beispiel #5
0
def main():
    principal = eval(input("Enter principal of mortgage: "))
    interestRate = eval(input("Enter percent interest rate: "))
    term = eval(input("Enter duration of mortgage in years: "))
    ans = mortgage.Mortgage(principal, interestRate, term)
    print("Monthly payment: ${0:,.2f}".format(ans.calculateMonthlyPayment()))
Beispiel #6
0
def rentVsBuy(purchase_price, down_decimal, years, interest, closing, selling_cost,\
        tax, appreciation, insurance, market_gains, current_rent, rental_increase, deposit,\
        rental_income, upfront_repair, value, plot, rental_stop):
    if value == 0:
        value = purchase_price
    months = years * 12
    market_gains_p = 1 + market_gains / 12
    down = purchase_price * down_decimal
    principle = purchase_price - down

    m = mortgage.Mortgage(interest, years, principle)
    payment = m.monthlyPayment()
    print("down: $", down, "\tdown+repair+closing: ",
          down + upfront_repair + closing * purchase_price)
    print("monthly mortgage payment: $", payment, "total monthly: $ ", \
            round(payment+(insurance+tax)*purchase_price/12.0,2), "cost to us: ",\
            round(payment+(insurance+tax)*purchase_price/12.0 - rental_income,2 ))
    #print("total paid on mortgage: $", round(m.totalPaid(),2), "total paid: $", \
    #        round(down+m.totalPaid(),2))

    #print("amotorization schedule")
    #    for month in range(0,months):
    #        principle, i_pmt, p_pmt = m.update(payment)
    #        print("month: ", month, "\t principle: ", principle, "\ti_pmt: ", i_pmt, "\tp_pmt: ", p_pmt)
    house_rental = rent.Rent(rental_income, 0)
    b = buy.Buy(purchase_price, down_decimal, interest, years, closing, tax, appreciation,\
            insurance,selling_cost,house_rental,value)
    r = rent.Rent(current_rent, deposit)
    costs = []

    #One time costs:
    rental = r.deposit()
    purchase = closing * purchase_price + down + upfront_repair
    b_opp_cost = purchase
    r_opp_cost = rental
    opp_cost_after_sale = purchase_price * (selling_cost + closing)
    costs.append(
        [rental, r_opp_cost, purchase, b_opp_cost, opp_cost_after_sale])

    flag = [1, 1, 1, 1]
    for month in range(1, months):
        if month % 12 == 0:
            #print("year end results:", costs[-1])
            r.increase(rental_increase)
            b.taxAppraisal()
            b._rent.increase(rental_increase)
        r_cost = r.update()
        b_cost, b_sell = b.update(
            b.monthlyPayment())  #includes rental if applicable
        rental += r_cost
        purchase += b_cost
        b_opp_cost = b_opp_cost * market_gains_p + b_cost
        r_opp_cost = r_opp_cost * market_gains_p + r_cost
        opp_cost_after_sale = b_opp_cost - b_sell
        costs.append(
            [rental, r_opp_cost, purchase, b_opp_cost, opp_cost_after_sale])

        if month == 60:
            print("year 5, sale: $", round(opp_cost_after_sale), "rent: $", round(r_opp_cost),\
                    "diff: $", round(opp_cost_after_sale-r_opp_cost))
            if rental_stop:
                b._rent._rent += r._rent
                print("rent income increasing at year 5 to: ",
                      round(b._rent._rent))
        if rental > purchase and flag[0]:
            #print("straight costs crossing at month: ", month, month/12.)
            flag[0] = 0
        if r_opp_cost > b_opp_cost and flag[1]:
            print("buying is better w/o sale of property after month:  ",
                  month, "years: ", round(month / 12., 2))
            flag[1] = 0
        if r_opp_cost > opp_cost_after_sale and flag[2]:
            print("buying is better with sale of property after month: ",
                  month, "year: ", round(month / 12., 2))
            flag[2] = 0
        if 0 > opp_cost_after_sale and flag[3]:
            #print("reselling makes a profit after: ", month, month/12.)
            flag[3] = 0

    #print("monthly cost for last payment year 30: ", b_cost)

    #plots
    purchase_costs = [c[2] for c in costs]
    purchase_opp_costs = [c[3] for c in costs]
    resale_opp_costs = [c[4] for c in costs]
    rent_costs = [c[0] for c in costs]
    rent_opp_costs = [c[1] for c in costs]

    if 0:
        fig, ax = plt.subplots(2, 1)
        ax[0].plot(range(0, months), purchase_costs, label='purchase costs')
        ax[0].plot(range(0, months), rent_costs, label='rent costs')
        ax[1].plot(range(0, months),
                   purchase_opp_costs,
                   label='purchase opp costs')
        ax[1].plot(range(0, months),
                   resale_opp_costs,
                   label='resale opp costs')
        ax[1].plot(range(0, months), rent_opp_costs, label='rent costs')

        ax[0].legend()
        ax[1].legend()
        plt.show()
    if plot:
        fig, ax = plt.subplots()
        ax.plot(range(0, months),
                purchase_opp_costs,
                label='purchase opp costs')
        ax.plot(range(0, months), resale_opp_costs, label='resale opp costs')
        ax.plot(range(0, months), rent_opp_costs, label='rent costs')
        title = "purchase_price:"+str(purchase_price)+"; rent: "+str(current_rent)+\
                "; renter: "+str(rental_income)
        ax.set_title(title)
        ax.set_xlabel('months')
        ax.set_ylabel('$')
        ax.legend()
        plt.show()