Ejemplo n.º 1
0
        private decimal GeneralEquation(int period, decimal payment, decimal initialPeriods, decimal fractions, decimal rate)
        {
            decimal retval = 0;

            for (int x = 0; x < period; x++)
            {
                retval += payment / ((1.0M + fractions * rate) * DecimalUtils.Pow(1 + rate, initialPeriods + x));
            }
            return(retval);
        }
Ejemplo n.º 2
0
        private IEnumerable <AmortizationItem> GetPaymentStream()
        {
            var balance = LoanAmount;

            var monthlyPayment     = RecurrentPayment();
            var additionPpal       = _loanObj.ExtraPayment;
            int totalNumOfPayments = LoanTerm;

            for (int i = 0; i < totalNumOfPayments; i++)
            {
                if (balance > 0)
                {
                    decimal interestForMonth  = balance * RatePerPayment;
                    var     principalForMonth = monthlyPayment - (interestForMonth);

                    balance -= (principalForMonth + additionPpal);
                    AmortizationItem item = new AmortizationItem
                    {
                        MonthNro     = i + 1,
                        Interest     = DecimalUtils.RoundDecimalUp(interestForMonth),
                        Principal    = DecimalUtils.RoundDecimalUp(principalForMonth),
                        Balance      = DecimalUtils.RoundDecimalUp(balance),
                        PMI          = DecimalUtils.RoundDecimalUp(PeriodPMI),
                        Taxes        = DecimalUtils.RoundDecimalUp(PeriodTaxes),
                        ExtraPayment = additionPpal
                    };


                    yield return(item);
                }
                else
                {
                    yield break;
                }
            }
        }
Ejemplo n.º 3
0
        private decimal DefaultPaymentCalc()
        {
            decimal payment = (LoanAmount) * (DecimalUtils.Pow((1 + RatePerPayment), LoanTerm) * InterestRate) / (12 * (DecimalUtils.Pow((1 + RatePerPayment), LoanTerm) - 1));

            return(payment);
        }