コード例 #1
0
        public static RateIndex Parse(string id,
                                      string instrumentId,
                                      string floatingRateIndex,
                                      string currency,
                                      string dayCountFraction,
                                      string paymentFrequency,
                                      string term)
        {
            var rateIndex = new RateIndex
            {
                currency = new IdentifiedCurrency {
                    Value = currency
                },
                dayCountFraction  = DayCountFractionHelper.Parse(dayCountFraction),
                floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex),
                id           = id,
                instrumentId = InstrumentIdArrayHelper.Parse(instrumentId)
            };
            Period frequency = null;

            if (paymentFrequency != null)
            {
                frequency = PeriodHelper.Parse(paymentFrequency);
            }
            rateIndex.paymentFrequency = frequency;
            Period period = null;

            if (term != null)
            {
                period = PeriodHelper.Parse(term);
            }
            rateIndex.term = period;
            return(rateIndex);
        }
コード例 #2
0
ファイル: FraPricer.cs プロジェクト: zhangz/Highlander.Net
        public static Trade CreateFraTrade(FraInputRange2 fraInputRange)
        {
            var trade = new Trade();
            var fra   = new Fra
            {
                adjustedEffectiveDate =
                    DateTypesHelper.ToRequiredIdentifierDate(fraInputRange.AdjustedEffectiveDate),
                adjustedTerminationDate          = fraInputRange.AdjustedTerminationDate,
                adjustedTerminationDateSpecified = true,
                paymentDate =
                    DateTypesHelper.ToAdjustableDate(fraInputRange.UnadjustedPaymentDate,
                                                     fraInputRange.PaymentDateBusinessDayConvention,
                                                     fraInputRange.PaymentDateBusinessCenters),
                Items = new object[] { new ProductType {
                                           Value = ProductTypeSimpleEnum.FRA.ToString()
                                       } },
                ItemsElementName = new[] { ItemsChoiceType2.productType }
            };

            if ("resetDate" != fraInputRange.FixingDayOffsetDateRelativeTo)
            {
                throw new ArgumentException("The fixing date must be specified as 'resetDate'-relative!", nameof(fraInputRange));
            }
            var fixingDayType = EnumHelper.Parse <DayTypeEnum>(fraInputRange.FixingDayOffsetDayType);

            fra.fixingDateOffset = RelativeDateOffsetHelper.Create(fraInputRange.FixingDayOffsetPeriod, fixingDayType,
                                                                   fraInputRange.FixingDayOffsetBusinessDayConvention,
                                                                   fraInputRange.FixingDayOffsetBusinessCenters,
                                                                   fraInputRange.FixingDayOffsetDateRelativeTo);
            fra.dayCountFraction = DayCountFractionHelper.Parse(fraInputRange.DayCountFraction);
            IDayCounter dayCounter = DayCounterHelper.Parse(fra.dayCountFraction.Value);

            fra.calculationPeriodNumberOfDays = dayCounter.DayCount(fra.adjustedEffectiveDate.Value, fra.adjustedTerminationDate).ToString(CultureInfo.InvariantCulture);
            fra.notional                = MoneyHelper.GetAmount(fraInputRange.NotionalAmount, fraInputRange.NotionalCurrency);
            fra.fixedRate               = (decimal)fraInputRange.FixedRate;
            fra.fixedRateSpecified      = true;
            fra.floatingRateIndex       = FloatingRateIndexHelper.Parse(fraInputRange.FloatingRateIndex);
            fra.indexTenor              = new[] { PeriodHelper.Parse(fraInputRange.IndexTenor) };
            fra.fraDiscounting          = fraInputRange.FraDiscounting;
            fra.fraDiscountingSpecified = true;
            PartyReference party1 = PartyReferenceFactory.Create("party1");
            PartyReference party2 = PartyReferenceFactory.Create("party2");

            fra.sellerPartyReference = party1;
            fra.buyerPartyReference  = party2;
            if (bool.Parse(fraInputRange.IsParty1Buyer))
            {
                fra.sellerPartyReference = party2;
                fra.buyerPartyReference  = party1;
            }
            XsdClassesFieldResolver.TradeSetFra(trade, fra);
            trade.id = fraInputRange.TradeId;
            return(trade);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableSimpleIRSwap"/> class.
 /// </summary>
 /// <param name="amount">The amount.</param>
 /// <param name="discountingType">The discounting type.</param>
 /// <param name="effectiveDate">The base date.</param>
 /// <param name="tenor">The maturity tenor.</param>
 /// <param name="fxdDayFraction">The fixed leg day fraction.</param>
 /// <param name="businessCenters">The payment business centers.</param>
 /// <param name="businessDayConvention">The payment business day convention.</param>
 /// <param name="fxdFrequency">The business day adjustments.</param>
 /// <param name="underlyingRateIndex">Index of the rate.</param>
 /// <param name="fixedRate">The fixed rate.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="baseDate">The base date.</param>
 /// <param name="currency">THe currency.</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 public PriceableSimpleIRSwap(string id, DateTime baseDate, string currency,
                              decimal amount, DiscountingTypeEnum?discountingType,
                              DateTime effectiveDate, string tenor, string fxdDayFraction,
                              string businessCenters, string businessDayConvention, string fxdFrequency,
                              RateIndex underlyingRateIndex, IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, BasicQuotation fixedRate)
     : this(baseDate, SimpleIrsHelper.Parse(id, currency, fxdDayFraction, tenor, fxdFrequency, id), effectiveDate,
            CalculationFactory.CreateFixed(fixedRate.value, MoneyHelper.GetAmount(amount, currency),
                                           DayCountFractionHelper.Parse(fxdDayFraction), discountingType),
            BusinessDayAdjustmentsHelper.Create(businessDayConvention, businessCenters), underlyingRateIndex, fixingCalendar, paymentCalendar, fixedRate)
 {
 }
コード例 #4
0
        public static Discounting Parse(decimal discountingRate, string dayCountFraction, DiscountingTypeEnum discountingTypeEnum)
        {
            var discounting = new Discounting
            {
                discountingType = discountingTypeEnum,
                discountRate    = discountingRate,
                discountRateDayCountFraction =
                    DayCountFractionHelper.Parse(dayCountFraction)
                    //discountRateSpecified = true
            };

            return(discounting);
        }
コード例 #5
0
        public static RateIndex Parse(string floatingRateIndex,
                                      string currency,
                                      string dayCountFraction)
        {
            var rateIndex = new RateIndex
            {
                currency = new IdentifiedCurrency {
                    Value = currency
                },
                dayCountFraction  = DayCountFractionHelper.Parse(dayCountFraction),
                floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex),
            };

            return(rateIndex);
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fraInputRange"></param>
        /// <returns></returns>
        public static Fra GetFpMLFra(FraInputRange fraInputRange)
        {
            var fra = new Fra
            {
                adjustedEffectiveDate =
                    DateTypesHelper.ToRequiredIdentifierDate(fraInputRange.AdjustedEffectiveDate),
                adjustedTerminationDate = fraInputRange.AdjustedTerminationDate,
                paymentDate             =
                    DateTypesHelper.ToAdjustableDate(fraInputRange.UnadjustedPaymentDate,
                                                     fraInputRange.PaymentDateBusinessDayConvention,
                                                     fraInputRange.PaymentDateBusinessCenters)
            };

            if ("resetDate" != fraInputRange.FixingDayOffsetDateRelativeTo)
            {
                throw new ArgumentException("The fixing date must be specified as 'resetDate'-relative!", nameof(fraInputRange));
            }
            var fixingDayType = EnumHelper.Parse <DayTypeEnum>(fraInputRange.FixingDayOffsetDayType);

            fra.fixingDateOffset = RelativeDateOffsetHelper.Create(fraInputRange.FixingDayOffsetPeriod, fixingDayType,
                                                                   fraInputRange.FixingDayOffsetBusinessDayConvention,
                                                                   fraInputRange.FixingDayOffsetBusinessCenters,
                                                                   fraInputRange.FixingDayOffsetDateRelativeTo);
            fra.dayCountFraction = DayCountFractionHelper.Parse(fraInputRange.DayCountFraction);
            IDayCounter dayCounter = DayCounterHelper.Parse(fra.dayCountFraction.Value);

            fra.calculationPeriodNumberOfDays = dayCounter.DayCount(fra.adjustedEffectiveDate.Value, fra.adjustedTerminationDate).ToString();
            fra.notional          = MoneyHelper.GetAmount(fraInputRange.NotionalAmount, fraInputRange.NotionalCurrency);
            fra.fixedRate         = (decimal)fraInputRange.FixedRate;
            fra.floatingRateIndex = FloatingRateIndexHelper.Parse(fraInputRange.FloatingRateIndex);
            fra.indexTenor        = new[] { PeriodHelper.Parse(fraInputRange.IndexTenor) };
            fra.fraDiscounting    = fraInputRange.FraDiscounting;
            PartyReference nabParty     = PartyReferenceFactory.Create("NAB");
            PartyReference counterParty = PartyReferenceFactory.Create("COUNTERPARTY");

            if (bool.Parse(fraInputRange.Sell))
            {
                fra.sellerPartyReference = nabParty;
                fra.buyerPartyReference  = counterParty;
            }
            else
            {
                fra.sellerPartyReference = counterParty;
                fra.buyerPartyReference  = nabParty;
            }
            return(fra);
        }
コード例 #7
0
ファイル: AssetHelper.cs プロジェクト: zhangz/Highlander.Net
        /// <summary>
        /// Parses the string info into an asset.
        /// </summary>
        /// <param name="bondTypeId">The type of bond.</param>
        /// <param name="coupon">The coupon rate</param>
        /// <param name="daycount">The daycount.</param>
        /// <param name="frequency">The frequency.</param>
        /// <param name="ytm">The ytm.</param>
        /// <param name="maturityDate">The maturity date.</param>
        /// <returns></returns>
        public static Pair <Asset, BasicAssetValuation> ParseBond(string bondTypeId, DateTime maturityDate, decimal coupon, string daycount, string frequency, decimal ytm)
        {
            const string rateQuotationType = "MarketQuote";
            var          bondId            = bondTypeId + '-' + coupon + '-' + maturityDate.ToShortDateString();
            var          underlyingAsset   = new Bond
            {
                id                  = bondId,
                maturity            = maturityDate,
                maturitySpecified   = true,
                couponRate          = coupon,
                couponRateSpecified = true,
                dayCountFraction    = DayCountFractionHelper.Parse(daycount),
                paymentFrequency    = PeriodHelper.Parse(frequency)
            };
            var listBasicQuotations = new List <BasicQuotation>
            {
                BasicQuotationHelper.Create(ytm, rateQuotationType, "DecimalRate")
            };

            return(new Pair <Asset, BasicAssetValuation>(underlyingAsset, BasicAssetValuationHelper.Create(underlyingAsset.id, listBasicQuotations.ToArray())));
        }
コード例 #8
0
        public static RateIndex Parse(string floatingRateIndex,
                                      string currency,
                                      string dayCountFraction, string term)
        {
            var rateIndex = new RateIndex
            {
                currency = new IdentifiedCurrency {
                    Value = currency
                },
                dayCountFraction  = DayCountFractionHelper.Parse(dayCountFraction),
                floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex),
            };
            Period period = null;

            if (term != null)
            {
                period = PeriodHelper.Parse(term);
            }
            rateIndex.term = period;
            return(rateIndex);
        }
コード例 #9
0
        public static RateIndex Parse(string instrumentId,
                                      string floatingRateIndex,
                                      string currency,
                                      string dayCountFraction,
                                      string paymentFrequency,
                                      string term)
        {
            var rateIndex = new RateIndex
            {
                currency = new IdentifiedCurrency {
                    Value = currency
                },
                dayCountFraction  = DayCountFractionHelper.Parse(dayCountFraction),
                floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex),
                id               = instrumentId,
                instrumentId     = InstrumentIdArrayHelper.Parse(instrumentId),
                paymentFrequency = PeriodHelper.Parse(paymentFrequency),
                term             = PeriodHelper.Parse(term)
            };

            return(rateIndex);
        }
コード例 #10
0
        /// <summary>
        /// Builds a term deposit.
        /// </summary>
        /// <param name="productType"></param>
        /// <param name="tradeDate"></param>
        /// <param name="startDate"></param>
        /// <param name="maturityDate"></param>
        /// <param name="currency"></param>
        /// <param name="notionalAmount"></param>
        /// <param name="fixedRate"></param>
        /// <param name="dayCount"></param>
        /// <returns></returns>
        public static TermDeposit Parse(string productType, DateTime tradeDate, DateTime startDate,
                                        DateTime maturityDate, string currency, decimal notionalAmount, decimal fixedRate, string dayCount)
        {
            var termDeposit = new TermDeposit
            {
                dayCountFraction       = DayCountFractionHelper.Parse(dayCount),
                fixedRate              = fixedRate,
                fixedRateSpecified     = true,
                principal              = MoneyHelper.GetPositiveMoney(notionalAmount, currency),
                startDate              = startDate,
                startDateSpecified     = true,
                maturityDate           = maturityDate,
                maturityDateSpecified  = true,
                payerPartyReference    = PartyReferenceHelper.Parse("Party1"),
                receiverPartyReference = PartyReferenceHelper.Parse("Party2"),
                Items            = new object[] { ProductTypeHelper.Create(ProductTypeSimpleEnum.TermDeposit.ToString()) },
                ItemsElementName = new[] { ItemsChoiceType2.productType }
            };

            //Set the party information
            return(termDeposit);
        }
        private static InterestRateStream GenerateFixedStreamDefinition(SwapLegParametersRange legParametersRange)
        {
            var discountingType = legParametersRange.DiscountingType;
            InterestRateStream stream;
            Discounting        discounting = null;

            if (discountingType != null && discountingType.ToUpper() != "NONE")
            {
                discounting = new Discounting {
                    discountingType = EnumHelper.Parse <DiscountingTypeEnum>(legParametersRange.DiscountingType), discountingTypeSpecified = true
                };
                stream = InterestRateStreamFactory.CreateFixedRateStream(DiscountingTypeToPayRelativeTo(discounting.discountingType));
            }
            else
            {
                stream = InterestRateStreamFactory.CreateFixedRateStream(DiscountingTypeToPayRelativeTo(null));
            }
            // Set effective and termination dates of the stream.
            //
            SetEffectiveAndTerminationDates(stream, legParametersRange.EffectiveDate, legParametersRange.MaturityDate, legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            //Set the FirstRegularPeriodStartDate
            SetFirstRegularPeriodStartDate(stream, legParametersRange.FirstRegularPeriodStartDate);
            //Set the LastRegularPeriodEndDate
            SetLastRegularPeriodEndDate(stream, legParametersRange.LastRegularPeriodEndDate);
            // Adjusted or unadjusted swap
            //
            var dateAdjustments = AdjustedType.Adjusted != legParametersRange.AdjustedType ? BusinessDayAdjustmentsHelper.Create(BusinessDayConventionEnum.NONE, legParametersRange.PaymentCalendar) : BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);

            stream.calculationPeriodDates.calculationPeriodDatesAdjustments = dateAdjustments;
            stream.calculationPeriodDates.calculationPeriodFrequency        = CalculationPeriodFrequencyHelper.Parse(legParametersRange.PaymentFrequency, legParametersRange.RollConvention);
            //Set FirstPeriodStartDate i.e. Full or Partial period.
            if (legParametersRange.FirstCouponType == FirstCouponType.Full)
            {
                var firstCouponStartDate = new AdjustableDate
                {
                    dateAdjustments = dateAdjustments, id = "FullFirstCoupon"
                };
                SetFirstPeriodStartDate(stream, firstCouponStartDate);
            }
            // Set payment dates frequency and adjustments
            //
            stream.paymentDates.paymentFrequency        = PeriodHelper.Parse(legParametersRange.PaymentFrequency).ToFrequency();
            stream.paymentDates.paymentDatesAdjustments = BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            Calculation calculation = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(stream.calculationPeriodAmount);

            //  Set discounting type
            //
            calculation.discounting = discounting;
            // Set notional amount (as the initial value in notional schedule)
            //
            SetNotional(calculation, legParametersRange.NotionalAmount, legParametersRange.Currency);
            // Set fixed rate (as the initial value in fixed-rate schedule)
            //
            Schedule fixedRateSchedule = ScheduleHelper.Create(legParametersRange.CouponOrLastResetRate);

            XsdClassesFieldResolver.CalculationSetFixedRateSchedule(calculation, fixedRateSchedule);
            // Set the 'day count convention'
            //
            calculation.dayCountFraction = DayCountFractionHelper.Parse(legParametersRange.DayCount);
            // Initial stub
            //
            //if (paymentCalendar==null)
            //{
            //    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, stream.paymentDates.paymentDatesAdjustments.businessCenters);
            //}
            //ProcessStubs(stream, legParametersRange, paymentCalendar);
            return(stream);
        }
        private static InterestRateStream GenerateCapFloorStreamDefinition(CapFloorLegParametersRange legParametersRange)
        {
            Discounting        discounting = null;
            InterestRateStream stream;

            if (legParametersRange.DiscountingType != null && legParametersRange.DiscountingType.ToUpper() != "NONE")
            {
                discounting = new Discounting
                {
                    discountingType =
                        EnumHelper.Parse <DiscountingTypeEnum>(legParametersRange.DiscountingType)
                };
                stream = InterestRateStreamFactory.CreateFloatingRateStream(DiscountingTypeToPayRelativeTo(discounting.discountingType));
            }
            // Create the stream object
            //
            else
            {
                stream = InterestRateStreamFactory.CreateFloatingRateStream(DiscountingTypeToPayRelativeTo(null));
            }
            // Set effective and termination dates of the stream.
            //
            SetEffectiveAndTerminationDates(stream, legParametersRange.EffectiveDate, legParametersRange.MaturityDate, legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            // Adjusted or unadjusted swap
            //
            stream.calculationPeriodDates.calculationPeriodDatesAdjustments = AdjustedType.Adjusted != legParametersRange.AdjustedType ? BusinessDayAdjustmentsHelper.Create(BusinessDayConventionEnum.NONE, legParametersRange.PaymentCalendar) : BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            stream.calculationPeriodDates.calculationPeriodFrequency        = CalculationPeriodFrequencyHelper.Parse(legParametersRange.PaymentFrequency, legParametersRange.RollConvention);
            stream.paymentDates.paymentFrequency        = PeriodHelper.Parse(legParametersRange.PaymentFrequency).ToFrequency();
            stream.paymentDates.paymentDatesAdjustments = BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            stream.resetDates.fixingDates           = RelativeDateOffsetHelper.Create(legParametersRange.PaymentFrequency, DayTypeEnum.Business, BusinessDayConventionEnum.NONE.ToString(), legParametersRange.FixingCalendar, "resetDates");//"NONE" & "resedDates" - hardcoded
            stream.resetDates.resetFrequency        = ResetFrequencyHelper.Parse(legParametersRange.PaymentFrequency);
            stream.resetDates.resetDatesAdjustments = BusinessDayAdjustmentsHelper.Create(legParametersRange.FixingBusinessDayAdjustments, legParametersRange.FixingCalendar);
            Calculation calculation = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(stream.calculationPeriodAmount);

            //  Set discounting type
            //
            calculation.discounting = discounting;
            // Set notional amount (as the initial value in notional schedule)
            //
            SetNotional(calculation, legParametersRange.NotionalAmount, legParametersRange.Currency);
            // Set floating rate index name
            //
            string indexTenor = legParametersRange.PaymentFrequency;
            string indexName  = legParametersRange.ForecastIndexName;
            FloatingRateCalculation floatingRateCalculation = FloatingRateCalculationFactory.Create(indexName, indexTenor, legParametersRange.FloatingRateSpread);

            XsdClassesFieldResolver.CalculationSetFloatingRateCalculation(calculation, floatingRateCalculation);
            if (legParametersRange.CapOrFloor == CapFloorType.Cap)
            {
                floatingRateCalculation.capRateSchedule = new[] { new StrikeSchedule() };
                floatingRateCalculation.capRateSchedule[0].initialValue = legParametersRange.StrikeRate;
                floatingRateCalculation.capRateSchedule[0].buyer        = new IdentifiedPayerReceiver {
                    Value = PayerReceiverEnum.Receiver
                };
                floatingRateCalculation.capRateSchedule[0].seller = new IdentifiedPayerReceiver {
                    Value = PayerReceiverEnum.Payer
                };
            }
            else
            {
                floatingRateCalculation.floorRateSchedule = new[] { new StrikeSchedule() };
                floatingRateCalculation.floorRateSchedule[0].initialValue = legParametersRange.StrikeRate;
                floatingRateCalculation.floorRateSchedule[0].buyer        = new IdentifiedPayerReceiver {
                    Value = PayerReceiverEnum.Receiver
                };
                floatingRateCalculation.floorRateSchedule[0].seller = new IdentifiedPayerReceiver {
                    Value = PayerReceiverEnum.Payer
                };
            }
            // Set day count convention
            //
            calculation.dayCountFraction = DayCountFractionHelper.Parse(legParametersRange.DayCount);
            return(stream);
        }
        private static InterestRateStream GenerateFloatingStreamDefinition(SwapLegParametersRange legParametersRange)
        {
            Discounting        discounting = null;
            InterestRateStream stream;

            if (legParametersRange.DiscountingType != null && legParametersRange.DiscountingType.ToUpper() != "NONE")
            {
                discounting = new Discounting {
                    discountingType = EnumHelper.Parse <DiscountingTypeEnum>(legParametersRange.DiscountingType)
                };
                // Create the stream object
                stream = InterestRateStreamFactory.CreateFloatingRateStream(DiscountingTypeToPayRelativeTo(discounting.discountingType));
            }
            else
            {
                // Create the stream object
                //
                stream = InterestRateStreamFactory.CreateFloatingRateStream(DiscountingTypeToPayRelativeTo(null));
            }
            // Set effective and termination dates of the stream.
            //
            SetEffectiveAndTerminationDates(stream, legParametersRange.EffectiveDate, legParametersRange.MaturityDate, legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            //Set the FirstRegularPeriodStartDate
            SetFirstRegularPeriodStartDate(stream, legParametersRange.FirstRegularPeriodStartDate);
            //Set the LastRegularPeriodEndDate
            SetLastRegularPeriodEndDate(stream, legParametersRange.LastRegularPeriodEndDate);
            // Adjusted or unadjusted swap
            //Set the stub period type
            var dateAdjustments = AdjustedType.Adjusted != legParametersRange.AdjustedType
                ? BusinessDayAdjustmentsHelper.Create(BusinessDayConventionEnum.NONE, legParametersRange.PaymentCalendar)
                : BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);

            stream.calculationPeriodDates.calculationPeriodDatesAdjustments = dateAdjustments;
            stream.calculationPeriodDates.calculationPeriodFrequency        = CalculationPeriodFrequencyHelper.Parse(legParametersRange.PaymentFrequency, legParametersRange.RollConvention);
            if (legParametersRange.FirstCouponType == FirstCouponType.Full)
            {
                var firstCouponStartDate = new AdjustableDate
                {
                    dateAdjustments = dateAdjustments, id = "FullFirstCoupon"
                };
                SetFirstPeriodStartDate(stream, firstCouponStartDate);
            }
            //Set the payment dates
            stream.paymentDates.paymentFrequency        = PeriodHelper.Parse(legParametersRange.PaymentFrequency).ToFrequency();
            stream.paymentDates.paymentDatesAdjustments = BusinessDayAdjustmentsHelper.Create(legParametersRange.PaymentBusinessDayAdjustments, legParametersRange.PaymentCalendar);
            stream.resetDates.fixingDates           = RelativeDateOffsetHelper.Create(legParametersRange.PaymentFrequency, DayTypeEnum.Business, BusinessDayConventionEnum.NONE.ToString(), legParametersRange.FixingCalendar, "resetDates");//"NONE" & "resedDates" - hardcoded
            stream.resetDates.resetFrequency        = ResetFrequencyHelper.Parse(legParametersRange.PaymentFrequency);
            stream.resetDates.resetDatesAdjustments = BusinessDayAdjustmentsHelper.Create(legParametersRange.FixingBusinessDayAdjustments, legParametersRange.FixingCalendar);
            Calculation calculation = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(stream.calculationPeriodAmount);

            //  Set discounting type
            //
            calculation.discounting = discounting;
            // Set notional amount (as the initial value in notional schedule)
            //
            SetNotional(calculation, legParametersRange.NotionalAmount, legParametersRange.Currency);
            // Set floating rate index name
            //
            string indexTenor = legParametersRange.PaymentFrequency;
            //string indexName = legParametersRange.ForecastCurve;
            string indexName = legParametersRange.ForecastIndexName;
            FloatingRateCalculation floatingRateCalculation = FloatingRateCalculationFactory.Create(indexName, indexTenor, legParametersRange.FloatingRateSpread);

            XsdClassesFieldResolver.CalculationSetFloatingRateCalculation(calculation, floatingRateCalculation);
            // Set day count convention
            //
            calculation.dayCountFraction = DayCountFractionHelper.Parse(legParametersRange.DayCount);
            return(stream);
        }