clone() public method

Returns a copy of itself linked to a different forwarding curve.
public clone ( Handle forwarding ) : IborIndex
forwarding Handle
return IborIndex
Ejemplo n.º 1
0
        public virtual SwapIndex clone(Handle <YieldTermStructure> forwarding)
        {
            if (exogenousDiscount_)
            {
                return(new SwapIndex(familyName(),
                                     tenor(),
                                     fixingDays(),
                                     currency(),
                                     fixingCalendar(),
                                     fixedLegTenor(),
                                     fixedLegConvention(),
                                     dayCounter(),
                                     iborIndex_.clone(forwarding),
                                     discount_));
            }

            return(new SwapIndex(familyName(),
                                 tenor(),
                                 fixingDays(),
                                 currency(),
                                 fixingCalendar(),
                                 fixedLegTenor(),
                                 fixedLegConvention(),
                                 dayCounter(),
                                 iborIndex_.clone(forwarding)));
        }
Ejemplo n.º 2
0
        protected override void initializeDates()
        {
            // dummy ibor index with curve/swap arguments
            IborIndex clonedIborIndex = iborIndex_.clone(termStructureHandle_);

            // do not pass the spread here, as it might be a Quote i.e. it can dinamically change
            swap_ = new MakeVanillaSwap(tenor_, clonedIborIndex, 0.0, fwdStart_)
                    .withFixedLegDayCount(fixedDayCount_)
                    .withFixedLegTenor(new Period(fixedFrequency_))
                    .withFixedLegConvention(fixedConvention_)
                    .withFixedLegTerminationDateConvention(fixedConvention_)
                    .withFixedLegCalendar(calendar_)
                    .withFloatingLegCalendar(calendar_);

            earliestDate_ = swap_.startDate();

            // Usually...
            latestDate_ = swap_.maturityDate();
            // ...but due to adjustments, the last floating coupon might
            // need a later date for fixing
            #if QL_USE_INDEXED_COUPON
            FloatingRateCoupon lastFloating = (FloatingRateCoupon)swap_.floatingLeg()[swap_.floatingLeg().Count - 1];
            Date fixingValueDate            = iborIndex_.valueDate(lastFloating.fixingDate());
            Date endValueDate = iborIndex_.maturityDate(fixingValueDate);
            latestDate_ = Date.Max(latestDate_, endValueDate);
            #endif
        }