CouponONArithmeticAverageSpreadSimplifiedDefinition extends CouponDefinition { @Override public CouponONArithmeticAverageSpreadSimplified toDerivative(final ZonedDateTime date) { ArgumentChecker.isTrue(!getAccrualStartDate().plusDays(_index.getPublicationLag()).isBefore(date), "First fixing publication strictly before reference date"); final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate()); final double fixingPeriodStartTimes = TimeCalculator.getTimeBetween(date, getAccrualStartDate()); final double fixingPeriodEndTimes = TimeCalculator.getTimeBetween(date, getAccrualEndDate()); return CouponONArithmeticAverageSpreadSimplified.from(paymentTime, getPaymentYearFraction(), getNotional(), _index, fixingPeriodStartTimes, fixingPeriodEndTimes, getPaymentYearFraction(), _spread); } CouponONArithmeticAverageSpreadSimplifiedDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate,
      final double paymentYearFraction, final double notional, final IndexON index, final double spread); static CouponONArithmeticAverageSpreadSimplifiedDefinition from(final IndexON index, final ZonedDateTime fixingPeriodStartDate, final Period tenor, final double notional,
      final int paymentLag, final BusinessDayConvention businessDayConvention, final boolean isEOM, final double spread, final Calendar calendar); static CouponONArithmeticAverageSpreadSimplifiedDefinition from(final IndexON index, final ZonedDateTime fixingPeriodStartDate, final ZonedDateTime fixingPeriodEndDate,
      final double notional, final int paymentLag, final double spread, final Calendar calendar); IndexON getIndex(); double getSpread(); double getSpreadAmount(); @Override CouponONArithmeticAverageSpreadSimplified toDerivative(final ZonedDateTime date); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void toDerivative() { final CouponONArithmeticAverageSpreadSimplified cpnConverted = FEDFUND_CPN_3M_DEF.toDerivative(TRADE_DATE); final double paymentTime = TimeCalculator.getTimeBetween(TRADE_DATE, PAYMENT_DATE); final double fixingStartTime = TimeCalculator.getTimeBetween(TRADE_DATE, ACCRUAL_START_DATE); final double fixingEndTime = TimeCalculator.getTimeBetween(TRADE_DATE, ACCRUAL_END_DATE); final CouponONArithmeticAverageSpreadSimplified cpnExpected = CouponONArithmeticAverageSpreadSimplified .from(paymentTime, ACCURAL_FACTOR, NOTIONAL, FEDFUND, fixingStartTime, fixingEndTime, FEDFUND_CPN_3M_DEF.getPaymentYearFraction(), SPREAD); assertEquals("CouponOISSimplified definition: toDerivative", cpnExpected, cpnConverted); }