public List <DetailedCashflowRangeItem> GetDetailedCashflowsWithNotionalSchedule( ILogger logger, ICoreCache cache, String nameSpace, IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, CapFloorLegParametersRange_Old legParametersRange, List <DateTimeDoubleRangeItem> notionalValueItems, ValuationRange valuationRange) { //Check if the calendars are null. If not build them! var list1 = notionalValueItems.Select(item => new Pair <DateTime, decimal>(item.DateTime, Convert.ToDecimal(item.Value))).ToList(); NonNegativeSchedule notionalScheduleFpML = NonNegativeScheduleHelper.Create(list1); Currency currency = CurrencyHelper.Parse(legParametersRange.Currency); NonNegativeAmountSchedule amountSchedule = NonNegativeAmountScheduleHelper.Create(notionalScheduleFpML, currency); InterestRateStream interestRateStream = GetCashflowsScheduleWithNotionalSchedule(fixingCalendar, paymentCalendar, legParametersRange, amountSchedule); //Add the principal exchanges to the cashflows. var principalExchangeList = list1.Select(cashflow => new PrincipalExchange { adjustedPrincipalExchangeDate = cashflow.First, adjustedPrincipalExchangeDateSpecified = true, principalExchangeAmount = cashflow.Second, principalExchangeAmountSpecified = true }).ToArray(); interestRateStream.cashflows.principalExchange = principalExchangeList; UpdateCashflowsWithAmounts(logger, cache, nameSpace, interestRateStream, legParametersRange, valuationRange); var list = new List <DetailedCashflowRangeItem>(); foreach (PaymentCalculationPeriod paymentCalculationPeriod in interestRateStream.cashflows.paymentCalculationPeriod) { var detailedCashflowRangeItem = new DetailedCashflowRangeItem(); detailedCashflowRangeItem.PaymentDate = paymentCalculationPeriod.adjustedPaymentDate; detailedCashflowRangeItem.StartDate = PaymentCalculationPeriodHelper.GetCalculationPeriodStartDate(paymentCalculationPeriod); detailedCashflowRangeItem.EndDate = PaymentCalculationPeriodHelper.GetCalculationPeriodEndDate(paymentCalculationPeriod); detailedCashflowRangeItem.NumberOfDays = PaymentCalculationPeriodHelper.GetNumberOfDays(paymentCalculationPeriod); detailedCashflowRangeItem.FutureValue = MoneyHelper.ToDouble(paymentCalculationPeriod.forecastPaymentAmount); detailedCashflowRangeItem.PresentValue = MoneyHelper.ToDouble(paymentCalculationPeriod.presentValueAmount); detailedCashflowRangeItem.DiscountFactor = (double)paymentCalculationPeriod.discountFactor; detailedCashflowRangeItem.NotionalAmount = (double)PaymentCalculationPeriodHelper.GetNotionalAmount(paymentCalculationPeriod); detailedCashflowRangeItem.CouponType = GetCouponType(paymentCalculationPeriod); detailedCashflowRangeItem.Rate = (double)PaymentCalculationPeriodHelper.GetRate(paymentCalculationPeriod); CalculationPeriod calculationPeriod = PaymentCalculationPeriodHelper.GetCalculationPeriods(paymentCalculationPeriod)[0]; FloatingRateDefinition floatingRateDefinition = XsdClassesFieldResolver.CalculationPeriodGetFloatingRateDefinition(calculationPeriod); switch (detailedCashflowRangeItem.CouponType.ToLower()) { case "cap": { Strike strike = floatingRateDefinition.capRate[0]; detailedCashflowRangeItem.StrikeRate = (double)strike.strikeRate; break; } case "floor": { Strike strike = floatingRateDefinition.floorRate[0]; detailedCashflowRangeItem.StrikeRate = (double)strike.strikeRate; break; } default: { string message = String.Format("Specified coupon type : '{0}' is not supported. Please use one of these: 'cap, floor'", detailedCashflowRangeItem.CouponType.ToLower()); throw new NotSupportedException(message); } } // If floating rate - retrieve the spread. // detailedCashflowRangeItem.Spread = (double)PaymentCalculationPeriodHelper.GetSpread(paymentCalculationPeriod); var fixingDate = new DateTime(); var tempDate = PaymentCalculationPeriodHelper.GetFirstFloatingFixingDate(paymentCalculationPeriod); if (tempDate != null) { fixingDate = (DateTime)tempDate; } detailedCashflowRangeItem.FixingDate = fixingDate; detailedCashflowRangeItem.Currency = "Not Specified"; if (currency != null) { detailedCashflowRangeItem.Currency = currency.Value; } list.Add(detailedCashflowRangeItem); } return(list); }