Пример #1
0
 public YoYInflationCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, YoYInflationIndex yoyIndex, Period observationLag, DayCounter dayCounter, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd)
     : base(paymentDate, nominal, startDate, endDate, fixingDays, yoyIndex, observationLag, dayCounter, refPeriodStart, refPeriodEnd)
 {
     yoyIndex_ = yoyIndex;
     gearing_ = gearing;
     spread_ = spread;
 }
Пример #2
0
		public YoYInflationCapFloorEngine( YoYInflationIndex index, Handle<YoYOptionletVolatilitySurface> vol )
		{
			index_ = index;
			volatility_ = vol;

			index_.registerWith( update );
			volatility_.registerWith(update);
		}
Пример #3
0
 public yoyInflationLeg(Schedule schedule,Calendar cal,
                        YoYInflationIndex index,
                        Period observationLag)
 {
    schedule_ = schedule;
    index_ = index;
    observationLag_ = observationLag;
    paymentAdjustment_ = BusinessDayConvention.ModifiedFollowing;
    paymentCalendar_ = cal;
 }
Пример #4
0
		private List<BootstrapHelper<YoYInflationTermStructure>> makeHelpers( Datum[] iiData, int N,
														YoYInflationIndex ii, Period observationLag,
														Calendar calendar,
														BusinessDayConvention bdc,
														DayCounter dc )
		{
			List<BootstrapHelper<YoYInflationTermStructure>> instruments = new List<BootstrapHelper<YoYInflationTermStructure>>();
			for ( int i = 0; i < N; i++ )
			{
				Date maturity = iiData[i].date;
				Handle<Quote> quote = new Handle<Quote>( new SimpleQuote( iiData[i].rate / 100.0 ) );
				BootstrapHelper<YoYInflationTermStructure> anInstrument = new YearOnYearInflationSwapHelper( quote, observationLag, maturity,
							 calendar, bdc, dc, ii );
				instruments.Add( anInstrument );
			}
			return instruments;
		}
 // ... or not
 public CappedFlooredYoYInflationCoupon(Date paymentDate,
                                        double nominal,
                                        Date startDate,
                                        Date endDate,
                                        int fixingDays,
                                        YoYInflationIndex index,
                                        Period observationLag,
                                        DayCounter dayCounter,
                                        double gearing      = 1.0,
                                        double spread       = 0.0,
                                        double?cap          = null,
                                        double?floor        = null,
                                        Date refPeriodStart = null,
                                        Date refPeriodEnd   = null)
     : base(paymentDate, nominal, startDate, endDate,
            fixingDays, index, observationLag, dayCounter,
            gearing, spread, refPeriodStart, refPeriodEnd)
 {
     isFloored_ = false;
     isCapped_  = false;
     setCommon(cap, floor);
 }
Пример #6
0
        public static List <CashFlow> yoyInflationLeg(List <double> notionals_,
                                                      Schedule schedule_,
                                                      BusinessDayConvention paymentAdjustment_,
                                                      YoYInflationIndex index_,
                                                      List <double> gearings_,
                                                      List <double> spreads_,
                                                      DayCounter paymentDayCounter_,
                                                      List <double> caps_,
                                                      List <double> floors_,
                                                      Calendar paymentCalendar_,
                                                      List <int> fixingDays_,
                                                      Period observationLag_)
        {
            int n = schedule_.Count - 1;

            Utils.QL_REQUIRE(!notionals_.empty(), () => "no notional given");
            Utils.QL_REQUIRE(notionals_.Count <= n, () => "too many nominals (" + notionals_.Count + "), only " + n + " required");
            if (gearings_ != null)
            {
                Utils.QL_REQUIRE(gearings_.Count <= n, () => "too many gearings (" + gearings_.Count + "), only " + n + " required");
            }
            if (spreads_ != null)
            {
                Utils.QL_REQUIRE(spreads_.Count <= n, () => "too many spreads (" + spreads_.Count + "), only " + n + " required");
            }
            if (caps_ != null)
            {
                Utils.QL_REQUIRE(caps_.Count <= n, () => "too many caps (" + caps_.Count + "), only " + n + " required");
            }
            if (floors_ != null)
            {
                Utils.QL_REQUIRE(floors_.Count <= n, () => "too many floors (" + floors_.Count + "), only " + n + " required");
            }


            List <CashFlow> leg = new List <CashFlow>(n);

            Calendar calendar = paymentCalendar_;

            Date refStart, start, refEnd, end;

            for (int i = 0; i < n; ++i)
            {
                refStart = start = schedule_.date(i);
                refEnd   = end = schedule_.date(i + 1);
                Date paymentDate = calendar.adjust(end, paymentAdjustment_);
                if (i == 0 && !schedule_.isRegular(i + 1))
                {
                    BusinessDayConvention bdc = schedule_.businessDayConvention();
                    refStart = schedule_.calendar().adjust(end - schedule_.tenor(), bdc);
                }
                if (i == n - 1 && !schedule_.isRegular(i + 1))
                {
                    BusinessDayConvention bdc = schedule_.businessDayConvention();
                    refEnd = schedule_.calendar().adjust(start + schedule_.tenor(), bdc);
                }
                if (Utils.Get(gearings_, i, 1.0).IsEqual(0.0))
                {
                    // fixed coupon
                    leg.Add(new FixedRateCoupon(paymentDate, Utils.Get(notionals_, i, 1.0),
                                                Utils.effectiveFixedRate(spreads_, caps_, floors_, i),
                                                paymentDayCounter_,
                                                start, end, refStart, refEnd));
                }
                else
                {
                    // yoy inflation coupon
                    if (Utils.noOption(caps_, floors_, i))
                    {
                        // just swaplet
                        YoYInflationCoupon coup = new YoYInflationCoupon(paymentDate,
                                                                         Utils.Get(notionals_, i, 1.0),
                                                                         start, end,
                                                                         Utils.Get(fixingDays_, i, 0),
                                                                         index_,
                                                                         observationLag_,
                                                                         paymentDayCounter_,
                                                                         Utils.Get(gearings_, i, 1.0),
                                                                         Utils.Get(spreads_, i, 0.0),
                                                                         refStart, refEnd);

                        // in this case you can set a pricer
                        // straight away because it only provides computation - not data
                        YoYInflationCouponPricer pricer = new YoYInflationCouponPricer();
                        coup.setPricer(pricer);
                        leg.Add(coup);
                    }
                    else
                    {
                        // cap/floorlet
                        leg.Add(new CappedFlooredYoYInflationCoupon(
                                    paymentDate,
                                    Utils.Get(notionals_, i, 1.0),
                                    start, end,
                                    Utils.Get(fixingDays_, i, 0),
                                    index_,
                                    observationLag_,
                                    paymentDayCounter_,
                                    Utils.Get(gearings_, i, 1.0),
                                    Utils.Get(spreads_, i, 0.0),
                                    Utils.toNullable(Utils.Get(caps_, i, Double.MinValue)),
                                    Utils.toNullable(Utils.Get(floors_, i, Double.MinValue)),
                                    refStart, refEnd));
                    }
                }
            }

            return(leg);
        }
 // ... or not
 public CappedFlooredYoYInflationCoupon(Date paymentDate,
                                      double nominal,
                                      Date startDate,
                                      Date endDate,
                                      int fixingDays,
                                      YoYInflationIndex index,
                                      Period observationLag,
                                      DayCounter dayCounter,
                                      double gearing = 1.0,
                                      double spread = 0.0,
                                      double? cap = null,
                                      double? floor = null,
                                      Date refPeriodStart = null,
                                      Date refPeriodEnd = null)
     : base(paymentDate, nominal, startDate, endDate,
        fixingDays, index, observationLag,  dayCounter,
        gearing, spread, refPeriodStart, refPeriodEnd)
 {
     isFloored_ = false;
      isCapped_ = false;
      setCommon(cap, floor);
 }
Пример #8
0
 public YoYInflationBachelierCapFloorEngine(YoYInflationIndex index, Handle <YoYOptionletVolatilitySurface> vol)
     : base(index, vol)
 {
 }
Пример #9
0
 public YoYInflationUnitDisplacedBlackCapFloorEngine(YoYInflationIndex index, Handle <YoYOptionletVolatilitySurface> vol)
     : base(index, vol)
 {
 }
Пример #10
0
 public CappedFlooredYoYInflationCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, YoYInflationIndex index, Period observationLag, DayCounter dayCounter)
     : this(paymentDate, nominal, startDate, endDate, fixingDays, index, observationLag, dayCounter, 1.0, 0.0, null, null, null, null)
 {
 }
Пример #11
0
 public YoYInflationCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, YoYInflationIndex yoyIndex, Period observationLag, DayCounter dayCounter, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd)
     : base(paymentDate, nominal, startDate, endDate, fixingDays, yoyIndex, observationLag, dayCounter, refPeriodStart, refPeriodEnd)
 {
     yoyIndex_ = yoyIndex;
     gearing_  = gearing;
     spread_   = spread;
 }
 public CappedFlooredYoYInflationCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, YoYInflationIndex index, Period observationLag, DayCounter dayCounter)
     : this(paymentDate, nominal, startDate, endDate, fixingDays, index, observationLag, dayCounter, 1.0, 0.0, null, null, null, null)
 {
 }
Пример #13
0
		public YoYInflationBachelierCapFloorEngine(YoYInflationIndex index,Handle<YoYOptionletVolatilitySurface> vol)
			: base( index, vol )
		{ }
Пример #14
0
		public YoYInflationUnitDisplacedBlackCapFloorEngine(YoYInflationIndex index,Handle<YoYOptionletVolatilitySurface> vol)
			: base( index, vol )
		{ }