Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public FraRateHelper(double rate,
                             int monthsToStart,
                             int monthsToEnd,
                             int fixingDays,
                             Calendar calendar,
                             BusinessDayConvention convention,
                             bool endOfMonth,
                             DayCounter dayCounter,
                             Pillar.Choice pillarChoice = Pillar.Choice.LastRelevantDate,
                             Date customPillarDate      = null)
            : base(rate)
        {
            periodToStart_ = new Period(monthsToStart, TimeUnit.Months);
            pillarChoice_  = pillarChoice;

            Utils.QL_REQUIRE(monthsToEnd > monthsToStart, () =>
                             "monthsToEnd (" + monthsToEnd + ") must be grater than monthsToStart (" + monthsToStart + ")");

            iborIndex_ = new IborIndex("no-fix", new Period(monthsToEnd - monthsToStart, TimeUnit.Months), fixingDays,
                                       new Currency(), calendar, convention, endOfMonth, dayCounter, termStructureHandle_);
            pillarDate_ = customPillarDate;
            initializeDates();
        }
Esempio n. 3
0
        public SwapRateHelper(Handle <Quote> rate,
                              SwapIndex swapIndex,
                              Handle <Quote> spread = null,
                              Period fwdStart       = null,
                              // exogenous discounting curve
                              Handle <YieldTermStructure> discount = null,
                              Pillar.Choice pillarChoice           = Pillar.Choice.LastRelevantDate,
                              Date customPillarDate = null)
            : base(rate)
        {
            spread_   = spread ?? new Handle <Quote>();
            fwdStart_ = fwdStart ?? new Period(0, TimeUnit.Days);

            settlementDays_  = swapIndex.fixingDays();
            tenor_           = swapIndex.tenor();
            pillarChoice_    = pillarChoice;
            calendar_        = swapIndex.fixingCalendar();
            fixedConvention_ = swapIndex.fixedLegConvention();
            fixedFrequency_  = swapIndex.fixedLegTenor().frequency();
            fixedDayCount_   = swapIndex.dayCounter();
            iborIndex_       = swapIndex.iborIndex();
            fwdStart_        = fwdStart;
            discountHandle_  = discount ?? new Handle <YieldTermStructure>();

            // take fixing into account
            iborIndex_ = swapIndex.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();
        }
Esempio n. 4
0
 public FraRateHelper(double rate,
                      Period periodToStart,
                      int lengthInMonths,
                      int fixingDays,
                      Calendar calendar,
                      BusinessDayConvention convention,
                      bool endOfMonth,
                      DayCounter dayCounter,
                      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_ = new IborIndex("no-fix", // correct family name would be needed
                                new Period(lengthInMonths, TimeUnit.Months),
                                fixingDays,
                                new Currency(), calendar, convention,
                                endOfMonth, dayCounter, termStructureHandle_);
     pillarDate_ = customPillarDate;
     initializeDates();
 }
 public FraRateHelper(double rate, uint monthsToStart, uint monthsToEnd, uint fixingDays, Calendar calendar, BusinessDayConvention convention, bool endOfMonth, DayCounter dayCounter, Pillar.Choice pillar) : this(NQuantLibcPINVOKE.new_FraRateHelper__SWIG_4(rate, monthsToStart, monthsToEnd, fixingDays, Calendar.getCPtr(calendar), (int)convention, endOfMonth, DayCounter.getCPtr(dayCounter), (int)pillar), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 6
0
 public SwapRateHelper(QuoteHandle rate, Period tenor, Calendar calendar, Frequency fixedFrequency, BusinessDayConvention fixedConvention, DayCounter fixedDayCount, IborIndex index, QuoteHandle spread, Period fwdStart, YieldTermStructureHandle discountingCurve, uint settlementDays, Pillar.Choice pillar) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_1(QuoteHandle.getCPtr(rate), Period.getCPtr(tenor), Calendar.getCPtr(calendar), (int)fixedFrequency, (int)fixedConvention, DayCounter.getCPtr(fixedDayCount), IborIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart), YieldTermStructureHandle.getCPtr(discountingCurve), settlementDays, (int)pillar), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 7
0
 public SwapRateHelper(double rate, SwapIndex index, QuoteHandle spread, Period fwdStart, YieldTermStructureHandle discountingCurve, Pillar.Choice pillar) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_21(rate, SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart), YieldTermStructureHandle.getCPtr(discountingCurve), (int)pillar), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }