Ejemplo n.º 1
0
  interestCostList.forEach( item => {

    if ( item.classList.contains( 'interest-cost-primary' ) ) {
      rate = rateCompare1Dom.value.replace( '%', '' );
    } else {
      rate = rateCompare2Dom.value.replace( '%', '' );
    }

    const length = parseInt( $( item ).parents( '.rc-comparison-section' ).find( '.loan-years' ).text(), 10 ) * 12;
    const amortizedVal = amortize( { amount: params.getVal( 'loan-amount' ), rate: rate, totalTerm: fullTerm, amortizeTerm: length } );
    const totalInterest = amortizedVal.interest;
    const roundedInterest = Math.round( unFormatUSD( totalInterest ) );
    const $el = $( item ).find( '.new-cost' );
    $el.text( formatUSD( roundedInterest, { decimalPlaces: 0 } ) );
    // Add short term rates, interest, and term to the shortTermVal array.
    if ( length < 180 ) {
      shortTermVal.push( {
        rate:     parseFloat( rate ),
        interest: parseFloat( totalInterest ),
        term:     length / 12
      } );
      renderInterestSummary( shortTermVal, 'short' );
    } else {
      longTermVal.push( {
        rate:     parseFloat( rate ),
        interest: parseFloat( totalInterest ),
        term:     length / 12
      } );
      renderInterestSummary( longTermVal, 'long' );
    }
  } );
Ejemplo n.º 2
0
 source: function() {
   return amortize({
     amount: positive( loan['amount-borrowed'] ),
     rate: loan['interest-rate'],
     totalTerm: loan['loan-term'] * 12,
     amortizeTerm: 60 // @todo loan term * 12?
   }).payment;
 }
mortgage['monthly-principal-interest'] = function (loan) {
    return Math.round(amortize({
                  amount: positive(loan['loan-amount']),
                  rate: loan['interest-rate'],
                  totalTerm: loan['loan-term'] * 12,
                  // since we are starting a new loan, 
                  // amortizeTerm is 0, since we haven't make
                  // any payment yet
                  amortizeTerm: 0
                }).payment);
};
Ejemplo n.º 4
0
 $('.interest-cost').each(function( index ) {
   var rate =  $(this).siblings().find('.rate-compare').val().replace('%', ''),
       length = (parseInt($(this).find('.loan-years').text(), 10)) * 12,
       amortizedVal = amortize({amount: params['loan-amount'], rate: rate, totalTerm: fullTerm, amortizeTerm: length}),
       totalInterest = amortizedVal['interest'],
       roundedInterest = Math.round( unFormatUSD(totalInterest) ),
       $el = $(this).find('.new-cost');
   $el.text( formatUSD(roundedInterest, {decimalPlaces: 0}) );
   // add short term rates, interest, and term to the shortTermVal array
   if (length < 180) {
     shortTermVal.push({rate: parseFloat(rate), interest: parseFloat(totalInterest), term: length/12});
   }
 });
Ejemplo n.º 5
0
 $('.interest-cost').each(function( index ) {
   if ( $(this).hasClass('interest-cost-primary') ) {
     rate = $('#rate-compare-1').val().replace('%', '');
   } else {
     rate = $('#rate-compare-2').val().replace('%', '');
   }
   var length = ( parseInt($(this).parents('.rc-comparison-section').find('.loan-years').text(), 10) ) * 12,
       amortizedVal = amortize( {amount: params['loan-amount'], rate: rate, totalTerm: fullTerm, amortizeTerm: length} ),
       totalInterest = amortizedVal['interest'],
       roundedInterest = Math.round( unFormatUSD(totalInterest) ),
       $el = $(this).find('.new-cost');
   $el.text( formatUSD(roundedInterest, {decimalPlaces: 0}) );
   // add short term rates, interest, and term to the shortTermVal array
   if (length < 180) {
     shortTermVal.push( {rate: parseFloat(rate), interest: parseFloat(totalInterest), term: length/12} );
     renderInterestSummary(shortTermVal, 'short');
   } else {
     longTermVal.push( {rate: parseFloat(rate), interest: parseFloat(totalInterest), term: length/12} );
     renderInterestSummary(longTermVal, 'long');
   }
 });
Ejemplo n.º 6
0
 $scope.update = function(loan) {
   $scope.master = amortize(angular.copy(loan));
 };
Ejemplo n.º 7
0
  evaluateCashFlow: function(data, price) {
    if (!price) { price = data.zestimate; }
    var rent = data.rentzestimate;

    var mortgageInfo = amortize({
      amount: price,
      rate: 4.625,
      totalTerm: 360,
      amortizeTerm: 12
    });

    var mortgage = Math.round(mortgageInfo.paymentRound);
    var taxes = Math.round(data.taxAssessment * 0.02 / 12);
    var insurance = Math.round(0.0004 * data.taxAssessment);
    var management = Math.round(1.7/12 * rent);
    var repairs = Math.round(0.1 * rent);
    var capEx = Math.round(200);
    var vacancy = Math.round(rent / 13);

    var totalCosts = mortgage + taxes + insurance + management + repairs + capEx + vacancy;
    var profit = rent - totalCosts;
    // returns include equity, appreciation, profit
    var returns = mortgageInfo.principalRound / 12 +
                  profit +
                  (data.taxAssessment * .02 / 12);
    var investment = price * 0.2;

    return {
      revenue: rent,
      expenses: totalCosts,
      profit: profit,
      returns: returns,
      investment: investment,
      expenseList: {
        mortgage: mortgage,
        taxes: taxes,
        insurance: insurance,
        management: management,
        repairs: repairs,
        capEx: capEx,
        vacancy: vacancy
      },
      ROI: {
        cacROI: profit * 12 / investment,
        ROI: returns / investment
      },
      assumptions: [
        "Vacancy rate is 7.7%",
        "Tax rate is 2.0%",
        "20% down payment",
        "4.625% interest rate",
        "capEx is $200/month",
        "repairs are 10% of monthly rent",
        "property management is 50% first month's rent + 10%/month",
        "insurance is roughly 0.0004 * tax assessment"
      ]
    };
    /*
    Revenue:
    - Rent: rentZestimate
    Expenses:
    - Mortgage: calculation, need price
    - Taxes: Taxable value (zillow), tax rate?
    - Insurance: Guess .0004 * taxable value
    - HOA: Guess? zillow?
    - Property Management: 50% 1st month + 10%
    - Repair: % of rent
    - CapEx: 200-ish
    */
    return true;
  }