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)); }
public double GetRemainingPrincipal(Date valueDate) { return(AmortizationSchedule.Where(x => x.Key > valueDate).Sum(x => x.Value)); }