CouponONSpreadSimplifiedDefinition extends CouponDefinition { @Override public CouponONSpread toDerivative(final ZonedDateTime date) { ArgumentChecker.notNull(date, "date"); ArgumentChecker.isTrue(!date.isAfter(_fixingPeriodStartDate) || date.toLocalDate().equals(_fixingPeriodStartDate.toLocalDate()), "Simplified Coupon OIS only valid for dates where the fixing has not taken place yet."); final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate()); final double fixingPeriodStartTime = TimeCalculator.getTimeBetween(date, _fixingPeriodStartDate); final double fixingPeriodEndTime = TimeCalculator.getTimeBetween(date, _fixingPeriodEndDate); final CouponONSpread cpn = new CouponONSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), _index, fixingPeriodStartTime, fixingPeriodEndTime, _fixingPeriodAccrualFactor, getNotional(), _spreadAmount); return cpn; } CouponONSpreadSimplifiedDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate,
      final ZonedDateTime accrualEndDate, final double paymentAccrualFactor, final double notional, final IndexON index, final ZonedDateTime fixingPeriodStartDate,
      final ZonedDateTime fixingPeriodEndDate, final double fixingPeriodAccrualFactor, final double spread); static CouponONSpreadSimplifiedDefinition from(final IndexON index, final ZonedDateTime settlementDate, final Period tenor, final double notional, final double spread,
      final int settlementDays, final BusinessDayConvention businessDayConvention, final boolean isEOM, final Calendar calendar); static CouponONSpreadSimplifiedDefinition from(final IndexON index, final ZonedDateTime settlementDate, final ZonedDateTime endFixingPeriodDate,
      final double notional, final double spread, final int settlementDays, final Calendar calendar); IndexON getIndex(); ZonedDateTime getFixingPeriodStartDate(); ZonedDateTime getFixingPeriodEndDate(); double getFixingPeriodAccrualFactor(); double getSpread(); double getSpreadAmount(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override CouponONSpread toDerivative(final ZonedDateTime date); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor);  }
@Test public void toDerivative() { final CouponONSpread cpnConverted = EONIA_COUPON_DEFINITION.toDerivative(TRADE_DATE); final double paymentTime = TimeCalculator.getTimeBetween(TRADE_DATE, PAYMENT_DATE); final double fixingStartTime = TimeCalculator.getTimeBetween(TRADE_DATE, START_ACCRUAL_DATE); final double fixingEndTime = TimeCalculator.getTimeBetween(TRADE_DATE, END_ACCRUAL_DATE); final double spreadAmount = SPREAD * NOTIONAL * PAYMENT_ACCRUAL_FACTOR; final CouponONSpread cpnExpected = new CouponONSpread(EUR_CUR, paymentTime, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, EUR_OIS, fixingStartTime, fixingEndTime, FIXING_YEAR_FRACTION, NOTIONAL, spreadAmount); assertEquals("CouponOISSimplified definition: toDerivative", cpnExpected, cpnConverted); }