public YoYInflationLeg(Schedule schedule, Calendar cal, YoYInflationIndex index, Period observationLag) { schedule_ = schedule; index_ = index; observationLag_ = observationLag; paymentAdjustment_ = BusinessDayConvention.ModifiedFollowing; paymentCalendar_ = cal; }
public IPricingEngine makeEngine(double volatility, int which) { YoYInflationIndex yyii = iir as YoYInflationIndex; Handle <YoYOptionletVolatilitySurface> vol = new Handle <YoYOptionletVolatilitySurface>( new ConstantYoYOptionletVolatility(volatility, settlementDays, calendar, convention, dc, observationLag, frequency, iir.interpolated())); switch (which) { case 0: return(new YoYInflationBlackCapFloorEngine(iir, vol)); //break; case 1: return(new YoYInflationUnitDisplacedBlackCapFloorEngine(iir, vol)); //break; case 2: return(new YoYInflationBachelierCapFloorEngine(iir, vol)); //break; default: QAssert.Fail("unknown engine request: which = " + which + "should be 0=Black,1=DD,2=Bachelier"); break; } // make compiler happy Utils.QL_FAIL("never get here - no engine resolution"); return(null); }
public List <CashFlow> makeYoYCapFlooredLeg(int which, Date startDate, int length, List <double> caps, List <double> floors, double volatility, double gearing = 1.0, double spread = 0.0) { Handle <YoYOptionletVolatilitySurface> vol = new Handle <YoYOptionletVolatilitySurface>( new ConstantYoYOptionletVolatility(volatility, settlementDays, calendar, convention, dc, observationLag, frequency, iir.interpolated())); YoYInflationCouponPricer pricer = null; switch (which) { case 0: pricer = new BlackYoYInflationCouponPricer(vol); break; case 1: pricer = new UnitDisplacedBlackYoYInflationCouponPricer(vol); break; case 2: pricer = new BachelierYoYInflationCouponPricer(vol); break; default: QAssert.Fail("unknown coupon pricer request: which = " + which + "should be 0=Black,1=DD,2=Bachelier"); break; } List <double> gearingVector = new InitializedList <double>(length, gearing); List <double> spreadVector = new InitializedList <double>(length, spread); YoYInflationIndex ii = iir as YoYInflationIndex; Date endDate = calendar.advance(startDate, new Period(length, TimeUnit.Years), BusinessDayConvention.Unadjusted); Schedule schedule = new Schedule(startDate, endDate, new Period(frequency), calendar, BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,// ref periods & acc periods DateGeneration.Rule.Forward, false); List <CashFlow> yoyLeg = new yoyInflationLeg(schedule, calendar, ii, observationLag) .withPaymentDayCounter(dc) .withGearings(gearingVector) .withSpreads(spreadVector) .withCaps(caps) .withFloors(floors) .withNotionals(nominals) .withPaymentAdjustment(convention); for (int i = 0; i < yoyLeg.Count; i++) { ((YoYInflationCoupon)(yoyLeg[i])).setPricer(pricer); } //setCouponPricer(iborLeg, pricer); return(yoyLeg); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(YoYInflationIndex obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
public YearOnYearInflationSwapHelper(double rate, Period lag, Date maturity, Calendar calendar, BusinessDayConvention bdc, DayCounter dayCounter, YoYInflationIndex index) : this(NQuantLibcPINVOKE.new_YearOnYearInflationSwapHelper(rate, Period.getCPtr(lag), Date.getCPtr(maturity), Calendar.getCPtr(calendar), (int)bdc, DayCounter.getCPtr(dayCounter), YoYInflationIndex.getCPtr(index)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(YoYInflationIndex obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public YearOnYearInflationSwap(_YearOnYearInflationSwap.Type type, double nominal, Schedule fixedSchedule, double fixedRate, DayCounter fixedDayCounter, Schedule yoySchedule, YoYInflationIndex index, Period lag, double spread, DayCounter yoyDayCounter, Calendar paymentCalendar) : this(NQuantLibcPINVOKE.new_YearOnYearInflationSwap__SWIG_1((int)type, nominal, Schedule.getCPtr(fixedSchedule), fixedRate, DayCounter.getCPtr(fixedDayCounter), Schedule.getCPtr(yoySchedule), YoYInflationIndex.getCPtr(index), Period.getCPtr(lag), spread, DayCounter.getCPtr(yoyDayCounter), Calendar.getCPtr(paymentCalendar)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public YearOnYearInflationSwapHelper(double rate, Period lag, Date maturity, Calendar calendar, BusinessDayConvention bdc, DayCounter dayCounter, YoYInflationIndex index) : this(NQuantLibcPINVOKE.new_YearOnYearInflationSwapHelper(rate, Period.getCPtr(lag), Date.getCPtr(maturity), Calendar.getCPtr(calendar), (int)bdc, DayCounter.getCPtr(dayCounter), YoYInflationIndex.getCPtr(index)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }
public YearOnYearInflationSwapHelper(QuoteHandle quote, Period lag, Date maturity, Calendar calendar, BusinessDayConvention bdc, DayCounter dayCounter, YoYInflationIndex index, YieldTermStructureHandle nominalTS) : this(NQuantLibcPINVOKE.new_YearOnYearInflationSwapHelper__SWIG_0(QuoteHandle.getCPtr(quote), Period.getCPtr(lag), Date.getCPtr(maturity), Calendar.getCPtr(calendar), (int)bdc, DayCounter.getCPtr(dayCounter), YoYInflationIndex.getCPtr(index), YieldTermStructureHandle.getCPtr(nominalTS)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public YearOnYearInflationSwap(_YearOnYearInflationSwap.Type type, double nominal, Schedule fixedSchedule, double fixedRate, DayCounter fixedDayCounter, Schedule yoySchedule, YoYInflationIndex index, Period lag, double spread, DayCounter yoyDayCounter, Calendar paymentCalendar) : this(NQuantLibcPINVOKE.new_YearOnYearInflationSwap__SWIG_1((int)type, nominal, Schedule.getCPtr(fixedSchedule), fixedRate, DayCounter.getCPtr(fixedDayCounter), Schedule.getCPtr(yoySchedule), YoYInflationIndex.getCPtr(index), Period.getCPtr(lag), spread, DayCounter.getCPtr(yoyDayCounter), Calendar.getCPtr(paymentCalendar)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }