private static void UpdateStubCalculationPeriodData(InterestRateStream interestRateStream, CalculationPeriod stubCalculationPeriod, StubValue stubValue, Notional notinalSchedule)
        {
            StubCalculationPeriodAmountHelper.UpdateStubCalculationPeriod(interestRateStream, stubCalculationPeriod, stubValue);
            decimal notional = NotionalHelper.GetNotionalValue(notinalSchedule, stubCalculationPeriod.adjustedStartDate);

            // Notinal amount
            //
            XsdClassesFieldResolver.CalculationPeriodSetNotionalAmount(stubCalculationPeriod, notional);
        }
        private static void UpdateCalculationPeriodData(Calculation calculation, CalculationPeriod calculationPeriod, Notional notinalSchedule)
        {
            bool hasFloatingRateCalculation = XsdClassesFieldResolver.CalculationHasFloatingRateCalculation(calculation);
            bool hasFixedRate = XsdClassesFieldResolver.CalculationHasFixedRateSchedule(calculation);

            if (!(hasFloatingRateCalculation ^ hasFixedRate))
            {
                throw new System.Exception("at least one type of rate (floating or fixed) must be specified.");
            }
            decimal notional = NotionalHelper.GetNotionalValue(notinalSchedule, calculationPeriod.adjustedStartDate);

            // Notional amount
            //
            XsdClassesFieldResolver.CalculationPeriodSetNotionalAmount(calculationPeriod, notional);
            // Fixed rate
            //
            if (hasFixedRate)
            {
                Schedule fixedRateSchedule = XsdClassesFieldResolver.CalculationGetFixedRateSchedule(calculation);
                decimal  fixedRate         = ScheduleHelper.GetValue(fixedRateSchedule, calculationPeriod.adjustedStartDate);
                XsdClassesFieldResolver.SetCalculationPeriodFixedRate(calculationPeriod, fixedRate);
            }
            //  Floating rate
            //
            else// if (hasFloatingRateCalculation)
            {
                // no observed, no calculated rate, spread == 0.0
                //
                var floatingRateDefinition = (FloatingRateDefinition)calculationPeriod.Item1 ?? new FloatingRateDefinition();
                //  check if stream has spreadSchedule
                //
                if (XsdClassesFieldResolver.CalculationHasSpreadSchedule(calculation))
                {
                    Schedule spreadSchedule = XsdClassesFieldResolver.GetCalculationSpreadSchedule(calculation);
                    decimal  spread         = ScheduleHelper.GetValue(spreadSchedule, calculationPeriod.adjustedStartDate);
                    floatingRateDefinition.spread          = spread;
                    floatingRateDefinition.spreadSpecified = true;
                }
                FloatingRateCalculation floatingRateCalculation = XsdClassesFieldResolver.CalculationGetFloatingRateCalculation(calculation);
                //  Check if there's a capRateSchedule
                //
                if (null != floatingRateCalculation.capRateSchedule)
                {
                    StrikeSchedule capRateSchedule = floatingRateCalculation.capRateSchedule[0];
                    var            capStrike       = new Strike();
                    var            capRate         = ScheduleHelper.GetValue(capRateSchedule, calculationPeriod.adjustedStartDate);
                    capStrike.strikeRate           = capRate;
                    floatingRateDefinition.capRate = new[] { capStrike };
                }
                //  Check if there's a capRateSchedule
                //
                if (null != floatingRateCalculation.floorRateSchedule)
                {
                    StrikeSchedule floorRateSchedule = floatingRateCalculation.floorRateSchedule[0];
                    var            floorStrike       = new Strike();
                    decimal        floorRate         = ScheduleHelper.GetValue(floorRateSchedule, calculationPeriod.adjustedStartDate);
                    floorStrike.strikeRate           = floorRate;
                    floatingRateDefinition.floorRate = new[] { floorStrike };
                }
                calculationPeriod.Item1 = floatingRateDefinition;
            }
        }