/// <summary>
 ///
 /// </summary>
 /// <param name="uniqueId"></param>
 /// <param name="payerIsBase"></param>
 /// <param name="accrualStartDate"></param>
 /// <param name="accrualEndDate"></param>
 /// <param name="adjustCalculationDatesIndicator"></param>
 /// <param name="paymentDate"></param>
 /// <param name="notionalAmount"></param>
 /// <param name="resetRelativeTo"></param>
 /// <param name="fixingDateRelativeOffset"></param>
 /// <param name="margin"></param>
 /// <param name="calculation"></param>
 /// <param name="forecastRateIndex"></param>
 /// <param name="fixingCalendar"></param>
 /// <param name="paymentCalendar"></param>
 public PriceableFloatingRateCoupon
     (string uniqueId
     , bool payerIsBase
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustCalculationDatesIndicator
     , AdjustableOrAdjustedDate paymentDate
     , Money notionalAmount
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , Decimal margin
     , Calculation calculation
     , ForecastRateIndex forecastRateIndex
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : this
     (uniqueId
      , payerIsBase
      , accrualStartDate
      , accrualEndDate
      , adjustCalculationDatesIndicator
      , paymentDate
      , notionalAmount
      , resetRelativeTo
      , fixingDateRelativeOffset
      , margin
      , 0.0m
      , calculation
      , forecastRateIndex
      , fixingCalendar
      , paymentCalendar)
 {
 }
Beispiel #2
0
 public PriceableStructuredRateCoupon
     (string uniqueId
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustCalculationDatesIndicator
     , AdjustableDate paymentDate
     , Money notionalAmount
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , RateIndex underlyingRateIndex
     , RelativeDateOffset resetLagOffset
     , Decimal margin
     , Calculation calculation
     , ForecastRateIndex forecastRateIndex
     )
     : base
         (uniqueId
         , accrualStartDate
         , accrualEndDate
         , adjustCalculationDatesIndicator
         , paymentDate
         , notionalAmount
         , resetRelativeTo
         , fixingDateRelativeOffset
         , margin
         , calculation
         , forecastRateIndex
         )
 {
     UnderlyingRateIndex = underlyingRateIndex;
     ResetLagOffset      = resetLagOffset;
     PriceableCouponType = CouponType.StructuredRate;
     AnalyticsModel      = new StructuredRateCouponAnalytic();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableFxRateCashflow"/> class.
 /// </summary>
 /// <param name="cashlfowId">The stream id.</param>
 /// <param name="payerIsBase">The payer is base flag.</param>
 /// <param name="accrualStartDate">The accrual start date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="accrualEndDate">The accrual end date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="adjustAccrualDatesIndicator">if set to <c>true</c> [adjust calculation dates indicator].</param>
 /// <param name="accrualBusinessCenters">The accrual business centers.</param>
 /// <param name="margin">The margin.</param>
 /// <param name="baseRate">The base rate for a nettable fixed/floating cash flow. </param>
 /// <param name="observedRate">The observed Rate.</param>
 /// <param name="notionalAmount">The notional amount.</param>
 /// <param name="dayCountfraction">Type of day Countfraction.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="accrualRollConvention">The accrual roll convention.</param>
 /// <param name="resetRelativeTo">reset relative to?</param>
 /// <param name="fixingDateRelativeOffset">The fixing date offset.</param>
 /// <param name="forecastRateIndex">The forecastrateindex.</param>
 /// <param name="discountingType">The swap discounting type.</param>
 /// <param name="discountRate">The discount rate.</param>
 /// <param name="fraDiscounting">Determines whether the coupon is discounted or not. If this parameter is null,
 /// then it is assumed that there is no fradiscounting</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 public PriceableFloatingRateCoupon
 (
     string cashlfowId
     , bool payerIsBase
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustAccrualDatesIndicator
     , BusinessCenters accrualBusinessCenters
     , BusinessDayConventionEnum accrualRollConvention
     , DayCountFraction dayCountfraction
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , Decimal margin
     , Decimal baseRate
     , Decimal?observedRate
     , Money notionalAmount
     , AdjustableOrAdjustedDate paymentDate
     , ForecastRateIndex forecastRateIndex
     , DiscountingTypeEnum?discountingType
     , Decimal?discountRate
     , FraDiscountingEnum?fraDiscounting
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : base(
         cashlfowId
         , CouponType.FloatingRate
         , payerIsBase
         , accrualStartDate
         , accrualEndDate
         , adjustAccrualDatesIndicator
         , accrualBusinessCenters
         , accrualRollConvention
         , dayCountfraction
         , observedRate
         , notionalAmount
         , paymentDate
         , discountingType
         , discountRate
         , fraDiscounting
         , paymentCalendar)
 {
     BaseRate        = baseRate;
     FixingCalendar  = fixingCalendar;
     ModelIdentifier = "DualCurveCouponModel";
     Id = cashlfowId;
     ForwardStartDate         = AccrualStartDate;
     ForecastRateIndex        = forecastRateIndex;
     FixingDateRelativeOffset = fixingDateRelativeOffset;
     ResetRelativeTo          = resetRelativeTo;
     Margin             = margin;
     AdjustedFixingDate = GetResetDate(resetRelativeTo, fixingDateRelativeOffset);
     if (observedRate != null)
     {
         RateObservation = RateObservationHelper.Parse(AdjustedFixingDate, (decimal)observedRate, "1");
     }
     SetRateObservation(RateObservation, ResetDate);
     ForecastCurveName = CurveNameHelpers.GetForecastCurveName(forecastRateIndex);
 }
        /// <summary>
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="interestRateStream"></param>
        /// <param name="listCalculationPeriods"></param>
        /// <param name="fixingCalendar"></param>
        /// <param name="nameSpace"></param>
        /// <returns></returns>
        /// <exception cref="NotSupportedException"></exception>
        /// <exception cref="NotImplementedException"></exception>
        public static List <DateTime> GetAdjustedResetDates(ICoreCache cache, InterestRateStream interestRateStream,
                                                            List <CalculationPeriod> listCalculationPeriods, IBusinessCalendar fixingCalendar, string nameSpace)
        {
            var        adjustedResetDates         = new List <DateTime>();
            ResetDates resetDates                 = interestRateStream.resetDates;
            Period     resetFrequency             = IntervalHelper.FromFrequency(resetDates.resetFrequency);
            Period     calculationPeriodFrequency = IntervalHelper.FromFrequency(interestRateStream.calculationPeriodDates.calculationPeriodFrequency);

            if (resetFrequency.period != calculationPeriodFrequency.period)
            {
                throw new NotSupportedException(
                          $"Reset period type ({resetFrequency.period}) and calculation period type ({calculationPeriodFrequency.period}) are different. This is not supported.");
            }

            if (int.Parse(resetFrequency.periodMultiplier) != int.Parse(calculationPeriodFrequency.periodMultiplier))
            {
                throw new NotSupportedException(
                          $"Reset period frequency ({resetFrequency.period}) is not equal to calculation period frequency ({calculationPeriodFrequency.period}). This is not supported.");
            }
            BusinessDayAdjustments resetDatesAdjustments = resetDates.resetDatesAdjustments;
            ResetRelativeToEnum    resetRelativeTo       = resetDates.resetRelativeTo;

            if (fixingCalendar == null)
            {
                fixingCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, resetDatesAdjustments.businessCenters, nameSpace);
            }
            foreach (CalculationPeriod calculationPeriodsInPaymentPeriod in listCalculationPeriods)
            {
                switch (resetRelativeTo)
                {
                case ResetRelativeToEnum.CalculationPeriodStartDate:
                {
                    DateTime unadjustedResetDate = calculationPeriodsInPaymentPeriod.unadjustedStartDate;
                    DateTime adjustedResetDate   = AdjustedDateHelper.ToAdjustedDate(fixingCalendar, unadjustedResetDate, resetDatesAdjustments);
                    adjustedResetDates.Add(adjustedResetDate);
                    break;
                }

                case ResetRelativeToEnum.CalculationPeriodEndDate:
                {
                    DateTime unadjustedResetDate = calculationPeriodsInPaymentPeriod.unadjustedEndDate;
                    DateTime adjustedResetDate   = AdjustedDateHelper.ToAdjustedDate(fixingCalendar, unadjustedResetDate, resetDatesAdjustments);
                    adjustedResetDates.Add(adjustedResetDate);
                    break;
                }

                default:
                {
                    throw new NotImplementedException("resetRelativeTo");
                }
                }
            }
            return(adjustedResetDates);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableCapFloorCoupon"/> class.
 /// </summary>
 /// <param name="uniqueId"></param>
 /// <param name="buyerIsBase">The buyer is base flag.</param>
 /// <param name="capStrike">The Cap strike.</param>
 /// <param name="floorStrike">The floor strike.</param>
 /// <param name="accrualStartDate"></param>
 /// <param name="accrualEndDate"></param>
 /// <param name="adjustCalculationDatesIndicator"></param>
 /// <param name="paymentDate"></param>
 /// <param name="notionalAmount"></param>
 /// <param name="resetRelativeTo"></param>
 /// <param name="fixingDateRelativeOffset"></param>
 /// <param name="margin"></param>
 /// <param name="calculation"></param>
 /// <param name="forecastRateIndex"></param>
 /// <param name="fixingCalendar"></param>
 /// <param name="paymentCalendar"></param>
 public PriceableCapFloorCoupon
     (string uniqueId
     , bool buyerIsBase
     , decimal?capStrike
     , decimal?floorStrike
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustCalculationDatesIndicator
     , AdjustableOrAdjustedDate paymentDate
     , Money notionalAmount
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , Decimal margin
     , Calculation calculation
     , ForecastRateIndex forecastRateIndex
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : base
         (uniqueId
         , buyerIsBase
         , accrualStartDate
         , accrualEndDate
         , adjustCalculationDatesIndicator
         , paymentDate
         , notionalAmount
         , resetRelativeTo
         , fixingDateRelativeOffset
         , margin
         , calculation
         , forecastRateIndex
         , fixingCalendar
         , paymentCalendar)
 {
     CapStrike             = capStrike;
     FloorStrike           = floorStrike;
     VolatilitySurfaceName = CurveNameHelpers.GetRateVolatilityMatrixName(forecastRateIndex);
     if (capStrike != null && floorStrike == null)
     {
         PriceableCouponType = CouponType.Cap;
         ModelIdentifier     = "DualCurveCapModel";
         IsCall = true;
     }
     if (floorStrike != null && capStrike == null)
     {
         PriceableCouponType = CouponType.Floor;
         ModelIdentifier     = "DualCurveFloorModel";
     }
     if (floorStrike != null && capStrike != null)
     {
         PriceableCouponType = CouponType.Collar;
         ModelIdentifier     = "DualCurveCollarModel";
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableFxRateCashflow"/> class.
 /// </summary>
 /// <param name="cashlfowId">The stream id.</param>
 /// <param name="payerIsBase">The payer is base flag.</param>
 /// <param name="accrualStartDate">The accrual start date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="accrualEndDate">The accrual end date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="adjustAccrualDatesIndicator">if set to <c>true</c> [adjust calculation dates indicator].</param>
 /// <param name="accrualBusinessCenters">The accrual business centers.</param>
 /// <param name="margin">The margin.</param>
 /// <param name="observedRate">The observed Rate.</param>
 /// <param name="notionalAmount">The notional amount.</param>
 /// <param name="dayCountfraction">Type of day Countfraction.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="accrualRollConvention">The accrual roll convention.</param>
 /// <param name="resetRelativeTo">reset relative to?</param>
 /// <param name="fixingDateRelativeOffset">The fixing date offset.</param>
 /// <param name="forecastRateIndex">The forecastrateindex.</param>
 /// <param name="discountingType">The swap discounting type.</param>
 /// <param name="discountRate">The discount rate.</param>
 /// <param name="fraDiscounting">Determines whether the coupon is discounted or not. If this parameter is null,
 /// then it is assumed that there is no fradiscounting</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 public PriceableFloatingRateCoupon
 (
     string cashlfowId
     , bool payerIsBase
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustAccrualDatesIndicator
     , BusinessCenters accrualBusinessCenters
     , BusinessDayConventionEnum accrualRollConvention
     , DayCountFraction dayCountfraction
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , Decimal margin
     , Decimal?observedRate
     , Money notionalAmount
     , AdjustableOrAdjustedDate paymentDate
     , ForecastRateIndex forecastRateIndex
     , DiscountingTypeEnum?discountingType
     , Decimal?discountRate
     , FraDiscountingEnum?fraDiscounting
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : this(
         cashlfowId
         , payerIsBase
         , accrualStartDate
         , accrualEndDate
         , adjustAccrualDatesIndicator
         , accrualBusinessCenters
         , accrualRollConvention
         , dayCountfraction
         , resetRelativeTo
         , fixingDateRelativeOffset
         , margin
         , 0.0m
         , observedRate
         , notionalAmount
         , paymentDate
         , forecastRateIndex
         , discountingType
         , discountRate
         , fraDiscounting
         , fixingCalendar
         , paymentCalendar)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableRateCoupon"/> class.
 /// </summary>
 /// <param name="cashlfowId">The stream id.</param>
 /// <param name="accrualStartDate">The accrual start date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="accrualEndDate">The accrual end date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="adjustCalculationDatesIndicator">if set to <c>true</c> [adjust calculation dates indicator].</param>
 /// <param name="accrualBusinessCenters">The accrual business centers.</param>
 /// <param name="underlyingRateIndex">Te underlying rate index can be Xibor or Swap.</param>
 /// <param name="resetLagOffset">This allows for non-standard lags to be used in convexity adjustment calculations.</param>
 /// <param name="margin">The margin.</param>
 /// <param name="observedRate">The observed Rate.</param>
 /// <param name="notionalAmount">The notional amount.</param>
 /// <param name="accrualDayCountfraction">Type of day Countfraction used for the acrual period.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="accrualRollConvention">The accrual roll convention.</param>
 /// <param name="resetRelativeTo">reset relative to?</param>
 /// <param name="fixingDateRelativeOffset">The fixing date offset.</param>
 /// <param name="forecastRateIndex">The forecastrateindex.</param>
 /// <param name="discountingType">The swap discounting type.</param>
 /// <param name="discountRate">The discount rate.</param>
 /// <param name="fraDiscounting">Determines whether the coupon is discounted or not. If this parameter is null,
 /// <param name="underlyingRateIndex"></param>
 /// then it is assumed that there is no fradiscounting</param>
 public PriceableStructuredRateCoupon
 (
     string cashlfowId
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustCalculationDatesIndicator
     , BusinessCenters accrualBusinessCenters
     , BusinessDayConventionEnum accrualRollConvention
     , DayCountFraction accrualDayCountfraction
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , RateIndex underlyingRateIndex
     , RelativeDateOffset resetLagOffset
     , Decimal margin
     , Decimal?observedRate
     , Money notionalAmount
     , AdjustableDate paymentDate
     , ForecastRateIndex forecastRateIndex
     , DiscountingTypeEnum?discountingType
     , Decimal?discountRate
     , FraDiscountingEnum?fraDiscounting)
     : base(
         cashlfowId
         , accrualStartDate
         , accrualEndDate
         , adjustCalculationDatesIndicator
         , accrualBusinessCenters
         , accrualRollConvention
         , accrualDayCountfraction
         , resetRelativeTo
         , fixingDateRelativeOffset
         , margin
         , observedRate
         , notionalAmount
         , paymentDate
         , forecastRateIndex
         , discountingType
         , discountRate
         , fraDiscounting
         )
 {
     UnderlyingRateIndex = underlyingRateIndex;
     ResetLagOffset      = resetLagOffset;
     PriceableCouponType = CouponType.StructuredRate;
     AnalyticsModel      = new StructuredRateCouponAnalytic();
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="uniqueId"></param>
        /// <param name="payerIsBase"></param>
        /// <param name="accrualStartDate"></param>
        /// <param name="accrualEndDate"></param>
        /// <param name="adjustCalculationDatesIndicator"></param>
        /// <param name="paymentDate"></param>
        /// <param name="notionalAmount"></param>
        /// <param name="resetRelativeTo"></param>
        /// <param name="fixingDateRelativeOffset"></param>
        /// <param name="margin"></param>
        /// <param name="baseRate"> </param>
        /// <param name="calculation"></param>
        /// <param name="forecastRateIndex"></param>
        /// <param name="fixingCalendar"></param>
        /// <param name="paymentCalendar"></param>
        public PriceableFloatingRateCoupon
            (string uniqueId
            , bool payerIsBase
            , DateTime accrualStartDate
            , DateTime accrualEndDate
            , Boolean adjustCalculationDatesIndicator
            , AdjustableOrAdjustedDate paymentDate
            , Money notionalAmount
            , ResetRelativeToEnum resetRelativeTo
            , RelativeDateOffset fixingDateRelativeOffset
            , Decimal margin
            , Decimal baseRate
            , Calculation calculation
            , ForecastRateIndex forecastRateIndex
            , IBusinessCalendar fixingCalendar
            , IBusinessCalendar paymentCalendar)
            : base
                (uniqueId
                , CouponType.FloatingRate
                , payerIsBase
                , accrualStartDate
                , accrualEndDate
                , adjustCalculationDatesIndicator
                , BusinessDayAdjustmentsHelper.Create(fixingDateRelativeOffset.businessDayConvention, fixingDateRelativeOffset.businessCenters)
                , calculation
                , notionalAmount
                , paymentDate
                , paymentCalendar)
        {
            BaseRate                 = baseRate;
            FixingCalendar           = fixingCalendar;
            ModelIdentifier          = "DualCurveCouponModel";
            ForwardStartDate         = AccrualStartDate;
            ForwardEndDate           = AccrualEndDate;
            ForecastRateIndex        = forecastRateIndex;
            FixingDateRelativeOffset = fixingDateRelativeOffset;
            ResetRelativeTo          = resetRelativeTo;
            Margin = margin;
            var floatingRateDefinition = (FloatingRateDefinition)calculation.Items[0];

            RateObservation    = floatingRateDefinition.rateObservation[0];
            AdjustedFixingDate = GetResetDate(resetRelativeTo, fixingDateRelativeOffset);
            SetRateObservation(RateObservation, ResetDate);
            ForecastCurveName = CurveNameHelpers.GetForecastCurveName(forecastRateIndex);
        }
        /// <summary>
        /// Gets the reset date.
        /// </summary>
        /// <param name="resetRelativeTo">The reset relative to.</param>
        /// <returns></returns>
        /// <param name="fixingDateRelativeOffset"></param>
        private DateTime GetResetDate(ResetRelativeToEnum resetRelativeTo, RelativeDateOffset fixingDateRelativeOffset)
        {
            var resetDate = AccrualStartDate;

            switch (resetRelativeTo)
            {
            case ResetRelativeToEnum.CalculationPeriodEndDate:
                resetDate = AccrualEndDate;
                break;
            }

            var interval = (Period)fixingDateRelativeOffset;

            if (fixingDateRelativeOffset != null)
            {
                var adjustment = BusinessDayAdjustmentsHelper.Create(fixingDateRelativeOffset.businessDayConvention, BusinessCentersHelper.BusinessCentersString(fixingDateRelativeOffset.businessCenters.businessCenter));
                resetDate = AdjustedDateHelper.ToAdjustedDate(FixingCalendar, resetDate, adjustment, OffsetHelper.FromInterval(interval, fixingDateRelativeOffset.dayType));
            }
            return(resetDate);
        }
 public ResetDates(XmlNode xmlNode)
 {
     XmlNodeList calculationPeriodDatesReferenceNodeList = xmlNode.SelectNodes("calculationPeriodDatesReference");
     if (calculationPeriodDatesReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationPeriodDatesReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationPeriodDatesReferenceIDRef = item.Attributes["id"].Name;
                 CalculationPeriodDatesReference ob = CalculationPeriodDatesReference();
                 IDManager.SetID(calculationPeriodDatesReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationPeriodDatesReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationPeriodDatesReference = new CalculationPeriodDatesReference(item);
             }
         }
     }
     
 
     XmlNodeList resetRelativeToNodeList = xmlNode.SelectNodes("resetRelativeTo");
     if (resetRelativeToNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in resetRelativeToNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 resetRelativeToIDRef = item.Attributes["id"].Name;
                 ResetRelativeToEnum ob = ResetRelativeToEnum();
                 IDManager.SetID(resetRelativeToIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 resetRelativeToIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 resetRelativeTo = new ResetRelativeToEnum(item);
             }
         }
     }
     
 
     XmlNodeList initialFixingDateNodeList = xmlNode.SelectNodes("initialFixingDate");
     if (initialFixingDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in initialFixingDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 initialFixingDateIDRef = item.Attributes["id"].Name;
                 RelativeDateOffset ob = RelativeDateOffset();
                 IDManager.SetID(initialFixingDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 initialFixingDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 initialFixingDate = new RelativeDateOffset(item);
             }
         }
     }
     
 
     XmlNodeList fixingDatesNodeList = xmlNode.SelectNodes("fixingDates");
     if (fixingDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fixingDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fixingDatesIDRef = item.Attributes["id"].Name;
                 RelativeDateOffset ob = RelativeDateOffset();
                 IDManager.SetID(fixingDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fixingDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fixingDates = new RelativeDateOffset(item);
             }
         }
     }
     
 
     XmlNodeList rateCutOffDaysOffsetNodeList = xmlNode.SelectNodes("rateCutOffDaysOffset");
     if (rateCutOffDaysOffsetNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in rateCutOffDaysOffsetNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 rateCutOffDaysOffsetIDRef = item.Attributes["id"].Name;
                 Offset ob = Offset();
                 IDManager.SetID(rateCutOffDaysOffsetIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 rateCutOffDaysOffsetIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rateCutOffDaysOffset = new Offset(item);
             }
         }
     }
     
 
     XmlNodeList resetFrequencyNodeList = xmlNode.SelectNodes("resetFrequency");
     if (resetFrequencyNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in resetFrequencyNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 resetFrequencyIDRef = item.Attributes["id"].Name;
                 ResetFrequency ob = ResetFrequency();
                 IDManager.SetID(resetFrequencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 resetFrequencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 resetFrequency = new ResetFrequency(item);
             }
         }
     }
     
 
     XmlNodeList resetDatesAdjustmentsNodeList = xmlNode.SelectNodes("resetDatesAdjustments");
     if (resetDatesAdjustmentsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in resetDatesAdjustmentsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 resetDatesAdjustmentsIDRef = item.Attributes["id"].Name;
                 BusinessDayAdjustments ob = BusinessDayAdjustments();
                 IDManager.SetID(resetDatesAdjustmentsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 resetDatesAdjustmentsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 resetDatesAdjustments = new BusinessDayAdjustments(item);
             }
         }
     }
     
 
 }
 public InterestLegResetDates(XmlNode xmlNode)
 {
     XmlNodeList calculationPeriodDatesReferenceNodeList = xmlNode.SelectNodes("calculationPeriodDatesReference");
     if (calculationPeriodDatesReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationPeriodDatesReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationPeriodDatesReferenceIDRef = item.Attributes["id"].Name;
                 InterestLegCalculationPeriodDatesReference ob = InterestLegCalculationPeriodDatesReference();
                 IDManager.SetID(calculationPeriodDatesReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationPeriodDatesReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationPeriodDatesReference = new InterestLegCalculationPeriodDatesReference(item);
             }
         }
     }
     
 
     XmlNodeList resetRelativeToNodeList = xmlNode.SelectNodes("resetRelativeTo");
     if (resetRelativeToNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in resetRelativeToNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 resetRelativeToIDRef = item.Attributes["id"].Name;
                 ResetRelativeToEnum ob = ResetRelativeToEnum();
                 IDManager.SetID(resetRelativeToIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 resetRelativeToIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 resetRelativeTo = new ResetRelativeToEnum(item);
             }
         }
     }
     
 
     XmlNodeList resetFrequencyNodeList = xmlNode.SelectNodes("resetFrequency");
     if (resetFrequencyNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in resetFrequencyNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 resetFrequencyIDRef = item.Attributes["id"].Name;
                 ResetFrequency ob = ResetFrequency();
                 IDManager.SetID(resetFrequencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 resetFrequencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 resetFrequency = new ResetFrequency(item);
             }
         }
     }
     
 
     XmlNodeList initialFixingDateNodeList = xmlNode.SelectNodes("initialFixingDate");
     if (initialFixingDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in initialFixingDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 initialFixingDateIDRef = item.Attributes["id"].Name;
                 RelativeDateOffset ob = RelativeDateOffset();
                 IDManager.SetID(initialFixingDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 initialFixingDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 initialFixingDate = new RelativeDateOffset(item);
             }
         }
     }
     
 
     XmlNodeList fixingDatesNodeList = xmlNode.SelectNodes("fixingDates");
     if (fixingDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fixingDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fixingDatesIDRef = item.Attributes["id"].Name;
                 AdjustableDatesOrRelativeDateOffset ob = AdjustableDatesOrRelativeDateOffset();
                 IDManager.SetID(fixingDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fixingDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fixingDates = new AdjustableDatesOrRelativeDateOffset(item);
             }
         }
     }
     
 
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableCapFloorCoupon"/> class.
 /// </summary>
 /// <param name="cashFlowId">The stream id.</param>
 /// <param name="buyerIsBase">The buyer is base flag.</param>
 /// <param name="capStrike">The Cap strike.</param>
 /// <param name="floorStrike">The floor strike.</param>
 /// <param name="accrualStartDate">The accrual start date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="accrualEndDate">The accrual end date. If adjusted, the adjustCalculationDatesIndicator should be false.</param>
 /// <param name="adjustAccrualDatesIndicator">if set to <c>true</c> [adjust calculation dates indicator].</param>
 /// <param name="accrualBusinessCenters">The accrual business centers.</param>
 /// <param name="margin">The margin.</param>
 /// <param name="observedRate">The observed Rate.</param>
 /// <param name="notionalAmount">The notional amount.</param>
 /// <param name="dayCountFraction">Type of day Count fraction.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="accrualRollConvention">The accrual roll convention.</param>
 /// <param name="resetRelativeTo">reset relative to?</param>
 /// <param name="fixingDateRelativeOffset">The fixing date offset.</param>
 /// <param name="forecastRateIndex">The forecast rate index.</param>
 /// <param name="discountingType">The swap discounting type.</param>
 /// <param name="discountRate">The discount rate.</param>
 /// <param name="fraDiscounting">Determines whether the coupon is discounted or not. If this parameter is null,
 /// then it is assumed that there is no fra discounting</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 public PriceableCapFloorCoupon
 (
     string cashFlowId
     , bool buyerIsBase
     , decimal?capStrike
     , decimal?floorStrike
     , DateTime accrualStartDate
     , DateTime accrualEndDate
     , Boolean adjustAccrualDatesIndicator
     , BusinessCenters accrualBusinessCenters
     , BusinessDayConventionEnum accrualRollConvention
     , DayCountFraction dayCountFraction
     , ResetRelativeToEnum resetRelativeTo
     , RelativeDateOffset fixingDateRelativeOffset
     , Decimal margin
     , Decimal?observedRate
     , Money notionalAmount
     , AdjustableOrAdjustedDate paymentDate
     , ForecastRateIndex forecastRateIndex
     , DiscountingTypeEnum?discountingType
     , Decimal?discountRate
     , FraDiscountingEnum?fraDiscounting
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : base(
         cashFlowId
         , buyerIsBase
         , accrualStartDate
         , accrualEndDate
         , adjustAccrualDatesIndicator
         , accrualBusinessCenters
         , accrualRollConvention
         , dayCountFraction
         , resetRelativeTo
         , fixingDateRelativeOffset
         , margin
         , observedRate
         , notionalAmount
         , paymentDate
         , forecastRateIndex
         , discountingType
         , discountRate
         , fraDiscounting
         , fixingCalendar
         , paymentCalendar)
 {
     CapStrike             = capStrike;
     FloorStrike           = floorStrike;
     VolatilitySurfaceName = CurveNameHelpers.GetRateVolatilityMatrixName(forecastRateIndex);
     if (capStrike != null && floorStrike == null)
     {
         PriceableCouponType = CouponType.Cap;
         ModelIdentifier     = "DualCurveCapModel";
         IsCall = true;
     }
     if (floorStrike != null && capStrike == null)
     {
         PriceableCouponType = CouponType.Floor;
         ModelIdentifier     = "DualCurveFloorModel";
     }
     if (floorStrike != null && capStrike != null)
     {
         PriceableCouponType = CouponType.Collar;
         ModelIdentifier     = "DualCurveCollarModel";
     }
 }