Exemplo n.º 1
0
        public IAmortization ResetAmortization(Date valueDate)
        {
            Dictionary <Date, double> amortizationSchedule = AmortizationSchedule.ToDictionary(x => x.Key, y => y.Value);

            if (RenormalizeAfterAmoritzation && AmortizationSchedule != null)
            {
                amortizationSchedule = AmortizationSchedule.Where(x => x.Key > valueDate).ToDictionary(x => x.Key, y => y.Value);
                var total = amortizationSchedule.Sum(y => y.Value);
                foreach (var scheduleKey in amortizationSchedule.ToDictionary(x => x.Key, y => y.Key).Keys)
                {
                    amortizationSchedule[scheduleKey] = amortizationSchedule[scheduleKey] / total;
                }
            }
            return(new Amortization(amortizationSchedule, RenormalizeAfterAmoritzation, AmortizationType));
        }