CapFloorInflationZeroCouponInterpolationDefinition extends CouponInflationDefinition implements CapFloor { @Override public CapFloorInflationZeroCouponInterpolation toDerivative(final ZonedDateTime date) { throw new OpenGammaRuntimeException("a time serie is needed"); } CapFloorInflationZeroCouponInterpolationDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate,
      final ZonedDateTime accrualEndDate, final double paymentYearFraction, final double notional, final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate,
      final int conventionalMonthLag, final int monthLag, final int maturity, final ZonedDateTime[] referenceStartDates, final ZonedDateTime[] referenceEndDates, final double weight,
      final double strike, final boolean isCap); static CapFloorInflationZeroCouponInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final int conventionalMonthLag, final int monthlag, final int maturity, final ZonedDateTime lastKnownFixingDate, final ZonedDateTime[] referenceEndDate,
      final double strike, final boolean isCap); static CapFloorInflationZeroCouponInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final int conventionalMonthLag, final int monthLag, final int maturity, final ZonedDateTime lastKnownFixingDate, final double strike,
      final boolean isCap); static CapFloorInflationZeroCouponInterpolationDefinition from(final CouponInflationZeroCouponInterpolationDefinition couponInflation, final ZonedDateTime lastKnownFixingDate,
      final int maturity, final double strike, final boolean isCap); ZonedDateTime getLastKnownFixingDate(); int getConventionalMonthLag(); int getMonthLag(); ZonedDateTime[] getReferenceStartDates(); ZonedDateTime[] getReferenceEndDates(); double getWeight(); int getMaturity(); @Override double getStrike(); @Override boolean isCap(); @Override CouponInflationDefinition with(final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate, final double notional); @Override double payOff(final double fixing); @Override CapFloorInflationZeroCouponInterpolation toDerivative(final ZonedDateTime date); @Override Coupon toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> priceIndexTimeSeries); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void toDerivativesStartMonthKnown() { final ZonedDateTime pricingDate = DateUtils.getUTCDate(2018, 6, 25); final DoubleTimeSeries<ZonedDateTime> priceIndexTS = ImmutableZonedDateTimeDoubleTimeSeries.ofUTC(new ZonedDateTime[] {DateUtils.getUTCDate(2017, 5, 1), DateUtils.getUTCDate(2017, 6, 1), DateUtils.getUTCDate(2018, 5, 1), DateUtils.getUTCDate(2018, 6, 1) }, new double[] {127.23, 127.43, 128.23, 128.43 }); final Coupon zeroCouponConverted = ZERO_COUPON_CAP_DEFINITION.toDerivative(pricingDate, priceIndexTS); final double paymentTime = ACT_ACT.getDayCountFraction(pricingDate, PAYMENT_DATE); final CouponFixed zeroCoupon = new CouponFixed(CUR, paymentTime, 1.0, NOTIONAL, Math.max( (WEIGHT * 128.23 + (1 - WEIGHT) * 128.43) / INDEX_START_VALUE - 1.0 - Math.pow(1 + STRIKE, MATURITY), 0.0)); assertEquals("Inflation zero-coupon: toDerivative", zeroCoupon, zeroCouponConverted); }