コード例 #1
0
        public BasisSwapHelper(Handle <Quote> spreadQuote,
                               int settlementDays,
                               Period swapTenor,
                               Calendar settlementCalendar,
                               BusinessDayConvention rollConvention,
                               IborIndex shortIndex,
                               IborIndex longIndex,
                               Handle <YieldTermStructure> discount = null,
                               bool eom           = true,
                               bool spreadOnShort = true)
            : base(spreadQuote)
        {
            settlementDays_     = settlementDays;
            settlementCalendar_ = settlementCalendar;
            swapTenor_          = swapTenor;
            rollConvention_     = rollConvention;
            shortIndex_         = shortIndex;
            longIndex_          = longIndex;
            spreadOnShort_      = spreadOnShort;
            eom_            = eom;
            discountHandle_ = discount ?? new Handle <YieldTermStructure>();

            bool shortIndexHasCurve = !shortIndex_.forwardingTermStructure().empty();
            bool longIndexHasCurve  = !longIndex_.forwardingTermStructure().empty();

            Utils.QL_REQUIRE(!(shortIndexHasCurve && longIndexHasCurve), () => "Have all curves, nothing to solve for.");

            /* Link the curve being bootstrapped to the index if the index has
             * no projection curve */
            if (!shortIndexHasCurve)
            {
                shortIndex_ = shortIndex_.clone(termStructureHandle_);
                //shortIndex_.unregisterWith(termStructureHandle_.link.update);
            }
            else if (!longIndexHasCurve)
            {
                longIndex_ = longIndex_.clone(termStructureHandle_);
                //longIndex_.unregisterWith(termStructureHandle_.link.update);
            }
            else
            {
                Utils.QL_FAIL("Need one leg of the basis swap to have its forward curve.");
            }

            shortIndex_.registerWith(update);
            longIndex_.registerWith(update);
            discountHandle_.registerWith(update);

            initializeDates();
        }
コード例 #2
0
ファイル: RateHelpers.cs プロジェクト: OpenDerivatives/QLCore
 public FraRateHelper(double rate,
                      Period periodToStart,
                      IborIndex iborIndex,
                      Pillar.Choice pillarChoice = Pillar.Choice.LastRelevantDate,
                      Date customPillarDate      = null)
     : base(rate)
 {
     periodToStart_ = periodToStart;
     pillarChoice_  = pillarChoice;
     // no way to take fixing into account,
     // even if we would like to for FRA over today
     iborIndex_ = iborIndex.clone(termStructureHandle_);
     iborIndex_.registerWith(update);
     pillarDate_ = customPillarDate;
     initializeDates();
 }
コード例 #3
0
ファイル: RateHelpers.cs プロジェクト: OpenDerivatives/QLCore
        public FraRateHelper(double rate,
                             int monthsToStart,
                             IborIndex i,
                             Pillar.Choice pillarChoice = Pillar.Choice.LastRelevantDate,
                             Date customPillarDate      = null)
            : base(rate)
        {
            periodToStart_ = new Period(monthsToStart, TimeUnit.Months);
            pillarChoice_  = pillarChoice;

            iborIndex_ = i.clone(termStructureHandle_);
            iborIndex_.registerWith(update);
            pillarDate_ = customPillarDate;

            initializeDates();
        }
コード例 #4
0
ファイル: RateHelpers.cs プロジェクト: OpenDerivatives/QLCore
        public FraRateHelper(Handle <Quote> rate,
                             int monthsToStart, IborIndex i,
                             Pillar.Choice pillarChoice = Pillar.Choice.LastRelevantDate,
                             Date customPillarDate      = null)
            : base(rate)
        {
            periodToStart_ = new Period(monthsToStart, TimeUnit.Months);
            pillarChoice_  = pillarChoice;
            iborIndex_     = i.clone(termStructureHandle_);

            // We want to be notified of changes of fixings, but we don't
            // want notifications from termStructureHandle_ (they would
            // interfere with bootstrapping.)
            iborIndex_.registerWith(update);
            pillarDate_ = customPillarDate;
            initializeDates();
        }
コード例 #5
0
ファイル: RateHelpers.cs プロジェクト: OpenDerivatives/QLCore
        public SwapRateHelper(double rate,
                              Period tenor,
                              Calendar calendar,
                              Frequency fixedFrequency,
                              BusinessDayConvention fixedConvention,
                              DayCounter fixedDayCount,
                              IborIndex iborIndex,
                              Handle <Quote> spread = null,
                              Period fwdStart       = null,
                              // exogenous discounting curve
                              Handle <YieldTermStructure> discount = null,
                              int?settlementDays         = null,
                              Pillar.Choice pillarChoice = Pillar.Choice.LastRelevantDate,
                              Date customPillarDate      = null)
            : base(rate)
        {
            settlementDays_  = settlementDays;
            tenor_           = tenor;
            pillarChoice_    = pillarChoice;
            calendar_        = calendar;
            fixedConvention_ = fixedConvention;
            fixedFrequency_  = fixedFrequency;
            fixedDayCount_   = fixedDayCount;
            spread_          = spread ?? new Handle <Quote>();
            fwdStart_        = fwdStart ?? new Period(0, TimeUnit.Days);
            discountHandle_  = discount ?? new Handle <YieldTermStructure>();

            if (settlementDays_ == null)
            {
                settlementDays_ = iborIndex.fixingDays();
            }

            // take fixing into account
            iborIndex_ = iborIndex.clone(termStructureHandle_);
            // We want to be notified of changes of fixings, but we don't
            // want notifications from termStructureHandle_ (they would
            // interfere with bootstrapping.)
            iborIndex_.registerWith(update);
            spread_.registerWith(update);
            discountHandle_.registerWith(update);

            pillarDate_ = customPillarDate;
            initializeDates();
        }
コード例 #6
0
ファイル: RateHelpers.cs プロジェクト: OpenDerivatives/QLCore
 public DepositRateHelper(double rate, IborIndex i)
     : base(rate)
 {
     iborIndex_ = i.clone(termStructureHandle_);
     initializeDates();
 }