Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PriceableIRSwap"/> class.
        /// </summary>
        /// <param name="baseDate">The base date.</param>
        /// <param name="nodeStruct">The nodeStruct;</param>
        /// <param name="fixingCalendar">The fixingCalendar.</param>
        /// <param name="paymentCalendar">The paymentCalendar.</param>
        /// <param name="fixedRate">The fixed rate.</param>
        public PriceableIRSwap(DateTime baseDate, SimpleIRSwapNodeStruct nodeStruct,
                               IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, BasicQuotation fixedRate)
            : base(baseDate, nodeStruct, fixingCalendar, paymentCalendar, fixedRate)
        {
            ModelIdentifier = DiscountingType == null ? "SwapAsset" : "DiscountSwapAsset";
            //The floating leg which is now non-zero.
            var unadjustedDateSchedule = DateScheduler.GetUnadjustedDateSchedule(AdjustedStartDate, SimpleIRSwap.term, UnderlyingRateIndex.term);

            FloatingLegAdjustedPeriodDates = AdjustedDateScheduler.GetAdjustedDateSchedule(unadjustedDateSchedule, BusinessDayAdjustments.businessDayConvention, fixingCalendar);
            FloatingLegWeightings          = CreateWeightings(CDefaultWeightingValue, FloatingLegAdjustedPeriodDates.Count - 1);
            FloatingLegYearFractions       = GetFloatingLegYearFractions();
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableSimpleInflationAsset"/> class.
 /// </summary>
 /// <param name="baseDate">The base date.</param>
 /// <param name="nodeStruct"></param>
 /// <param name="fixingCalendar"></param>
 /// <param name="paymentCalendar"></param>
 /// <param name="fixedRate">The fixed rate.</param>
 public PriceableSimpleZeroCouponInflationSwap(DateTime baseDate, SimpleIRSwapNodeStruct nodeStruct,
                                               IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, BasicQuotation fixedRate)
     : base(baseDate,
            XsdClassesFieldResolver.CalculationGetNotionalSchedule(nodeStruct.Calculation).notionalStepSchedule.initialValue, nodeStruct.DateAdjustments, fixedRate)
 {
     Id = nodeStruct.SimpleIRSwap.id;
     SimpleInflationSwap = nodeStruct.SimpleIRSwap;
     SpotDateOffset      = nodeStruct.SpotDate;
     Calculation         = nodeStruct.Calculation;
     UnderlyingRateIndex = nodeStruct.UnderlyingRateIndex;
     DayCounter          = DayCounterHelper.Parse(Calculation.dayCountFraction.Value);
     AdjustedStartDate   = GetSpotDate(baseDate, fixingCalendar, SpotDateOffset);
     RiskMaturityDate    = GetEffectiveDate(AdjustedStartDate, paymentCalendar, SimpleInflationSwap.term, nodeStruct.DateAdjustments.businessDayConvention);
     YearFraction        = GetYearFractions()[0];
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PriceableSimpleFra"/> class.
        /// </summary>
        /// <param name="baseDate">The base date.</param>
        /// <param name="nodeStruct"></param>
        /// <param name="fixingCalendar"></param>
        /// <param name="paymentCalendar"></param>
        /// <param name="fixedRate">The fixed rate.</param>
        public PriceableSimpleRevenueInflationSwap(DateTime baseDate, SimpleIRSwapNodeStruct nodeStruct,
                                                   IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, BasicQuotation fixedRate)
            : base(baseDate, nodeStruct.DateAdjustments, fixedRate)
        {
            Id = nodeStruct.SimpleIRSwap.id;
            SimpleInflationSwap = nodeStruct.SimpleIRSwap;
            SpotDateOffset      = nodeStruct.SpotDate;
            Calculation         = nodeStruct.Calculation;
            UnderlyingRateIndex = nodeStruct.UnderlyingRateIndex;
            AdjustedStartDate   = GetSpotDate(baseDate, fixingCalendar, SpotDateOffset);
            DayCounter          = DayCounterHelper.Parse(Calculation.dayCountFraction.Value);
            List <DateTime> unadjustedDateSchedule = DateScheduler.GetUnadjustedDateSchedule(AdjustedStartDate, SimpleInflationSwap.term, SimpleInflationSwap.paymentFrequency);

            AdjustedPeriodDates = AdjustedDateScheduler.GetAdjustedDateSchedule(unadjustedDateSchedule, nodeStruct.DateAdjustments.businessDayConvention, paymentCalendar);
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PriceableSimpleIRSwap"/> class.
        /// </summary>
        /// <param name="baseDate">The base date.</param>
        /// <param name="nodeStruct">The nodeStruct;</param>
        /// <param name="fixingCalendar">The fixingCalendar.</param>
        /// <param name="paymentCalendar">The paymentCalendar.</param>
        /// <param name="fixedRate">The fixed rate.</param>
        public PriceableSimpleIRSwap(DateTime baseDate, SimpleIRSwapNodeStruct nodeStruct,
                                     IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar, BasicQuotation fixedRate)
            : base(baseDate, nodeStruct.DateAdjustments, nodeStruct.Calculation, fixedRate)
        {
            Id = nodeStruct.SimpleIRSwap.id;
            FixingDateOffset    = nodeStruct.SpotDate;
            SimpleIRSwap        = nodeStruct.SimpleIRSwap;
            UnderlyingRateIndex = nodeStruct.UnderlyingRateIndex;
            //TODO: This needs to be modified to use backwards roll.
            AdjustedStartDate = GetSpotDate(baseDate, fixingCalendar, FixingDateOffset);
            List <DateTime> unadjustedDateSchedule = DateScheduler.GetUnadjustedDateSchedule(AdjustedStartDate, SimpleIRSwap.term, SimpleIRSwap.paymentFrequency);

            AdjustedPeriodDates =
                AdjustedDateScheduler.GetAdjustedDateSchedule(unadjustedDateSchedule, BusinessDayAdjustments.businessDayConvention, paymentCalendar);
            RiskMaturityDate = AdjustedPeriodDates[AdjustedPeriodDates.Count - 1];
            Weightings       = CreateWeightings(CDefaultWeightingValue, AdjustedPeriodDates.Count - 1);
            YearFractions    = GetYearFractions();
            ModelIdentifier  = DiscountingType == null ? "SimpleSwapAsset" : "SimpleDiscountSwapAsset";
            var timeToMaturity = Actual365.Instance.YearFraction(baseDate, RiskMaturityDate);

            EndDiscountFactor = (decimal)System.Math.Exp(-(double)fixedRate.value * timeToMaturity);
        }