/// <summary> /// Initializes a new instance of the <see cref="PriceableCapFloorCoupon"/> class. /// </summary> /// <param name="cashlFowId">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="margin">The margin.</param> /// <param name="observedRate">The observed Rate. If this is not null, then it is used.</param> /// <param name="notionalAmount">The notional amount.</param> /// <param name="adjustedFixingDate">The adjusted fixing date.</param> /// <param name="dayCountFraction">Type of day Count fraction.</param> /// <param name="paymentDate">The payment date.</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 cashlFowId , bool buyerIsBase , decimal?capStrike , decimal?floorStrike , DateTime accrualStartDate , DateTime accrualEndDate , DateTime adjustedFixingDate , DayCountFraction dayCountFraction , Decimal margin , Decimal?observedRate , Money notionalAmount , DateTime paymentDate , ForecastRateIndex forecastRateIndex , DiscountingTypeEnum?discountingType , Decimal?discountRate , FraDiscountingEnum?fraDiscounting , IBusinessCalendar fixingCalendar , IBusinessCalendar paymentCalendar) : base( cashlFowId , buyerIsBase , accrualStartDate , accrualEndDate , adjustedFixingDate , dayCountFraction , 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"; } }
/// <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> /// /// </summary> /// <param name="logger"></param> /// <param name="cache"></param> /// <param name="nameSpace"></param> /// <param name="swaptionFpML"> </param> /// <param name="basePartyReference"></param> /// <param name="forecastRateInterpolation"></param> public InterestRateSwaptionPricer(ILogger logger, ICoreCache cache, String nameSpace, Swaption swaptionFpML, string basePartyReference, Boolean forecastRateInterpolation) : base(logger, cache, nameSpace, swaptionFpML, basePartyReference, forecastRateInterpolation) { ProductType = ProductTypeSimpleEnum.InterestRateSwaption; var underlyingSwap = new InterestRateSwapPricer(logger, cache, nameSpace, null, swaptionFpML.swap, basePartyReference, forecastRateInterpolation); Swap = underlyingSwap; //Add the currencies for the trade pricer. foreach (var ccy in Swap.PaymentCurrencies) { if (!PaymentCurrencies.Contains(ccy)) { PaymentCurrencies.Add(ccy); } } if (underlyingSwap.SwapType == SwapType.FixedFloat && underlyingSwap.ProductType == ProductTypeSimpleEnum.InterestRateSwap) { if (Swap.BasePartyPayingFixed && underlyingSwap.PayLeg.Strike != null) { StrikeRate = (decimal)underlyingSwap.PayLeg.Strike; if (!IsBasePartyBuyer) { IsCall = true; } } if (!Swap.BasePartyPayingFixed && underlyingSwap.ReceiveLeg.Strike != null)// { StrikeRate = (decimal)underlyingSwap.ReceiveLeg.Strike; if (IsBasePartyBuyer) { IsCall = true; } } VolatilitySurfaceName = CurveNameHelpers.GetRateVolatilityMatrixName(swaptionFpML.swap); } BucketedDates = new DateTime[] { }; RiskMaturityDate = Swap.RiskMaturityDate; }
/// <summary> /// Initializes a new instance of the <see cref="PriceableCapFloorStream"/> class. All the cashflows must be signed. /// </summary> /// <param name="logger">The logger.</param> /// <param name="cache">The cache.</param> /// <param name="stream">The stream.</param> /// <param name="nameSpace">The nameSpace</param> /// <param name="payerIsBase">The flag for whether the payerreference is the base party.</param> /// <param name="forecastRateInterpolation">ForwardEndDate = forecastRateInterpolation ? AccrualEndDate /// : AdjustedDateHelper.ToAdjustedDate(forecastRateIndex.indexTenor.Add(AccrualStartDate), AccrualBusinessDayAdjustments);</param> /// <param name="fixingCalendar">The fixingCalendar.</param> /// <param name="paymentCalendar">The paymentCalendar.</param> public PriceableCapFloorStream(ILogger logger, ICoreCache cache, String nameSpace , bool payerIsBase, InterestRateStream stream, bool forecastRateInterpolation , IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar) : base(logger , cache , nameSpace , payerIsBase , stream , forecastRateInterpolation , fixingCalendar , paymentCalendar) { if (Calculation.Items == null) { return; } var floatingRateCalculation = (FloatingRateCalculation)Calculation.Items[0]; var floatingRateIndex = floatingRateCalculation.floatingRateIndex; var indexTenor = floatingRateCalculation.indexTenor.ToString(); var forecastRate = ForecastRateIndexHelper.Parse(floatingRateIndex.Value, indexTenor); VolatilitySurfaceName = CurveNameHelpers.GetRateVolatilityMatrixName(forecastRate); }
/// <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"; } }