SwapFuturesPriceDeliverableSecurityDefinition extends FuturesSecurityDefinition<SwapFuturesPriceDeliverableSecurity> { @Override public SwapFuturesPriceDeliverableSecurity toDerivative(final ZonedDateTime date) { final double lastTradingTime = TimeCalculator.getTimeBetween(date, getLastTradingDate()); final double deliveryTime = TimeCalculator.getTimeBetween(date, _deliveryDate); final SwapFixedCoupon<? extends Coupon> underlyingSwap = _underlyingSwap.toDerivative(date); return new SwapFuturesPriceDeliverableSecurity(lastTradingTime, deliveryTime, underlyingSwap, _notional); } SwapFuturesPriceDeliverableSecurityDefinition(final ZonedDateTime lastTradingDate, final SwapFixedIborDefinition underlyingSwap, final double notional); static SwapFuturesPriceDeliverableSecurityDefinition from(final ZonedDateTime effectiveDate, final GeneratorSwapFixedIbor generator, final Period tenor,
      final double notional, final double rate); ZonedDateTime getDeliveryDate(); SwapFixedIborDefinition getUnderlyingSwap(); double getNotional(); @Override SwapFuturesPriceDeliverableSecurity toDerivative(final ZonedDateTime date); @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 toDerivative() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 9, 21); final SwapFixedCoupon<? extends Coupon> underlying = SWAP_DEFINITION.toDerivative(referenceDate); final double expiryTime = TimeCalculator.getTimeBetween(referenceDate, LAST_TRADING_DATE); final double deliveryTime = TimeCalculator.getTimeBetween(referenceDate, EFFECTIVE_DATE); final SwapFuturesPriceDeliverableSecurity futuresExpected = new SwapFuturesPriceDeliverableSecurity(expiryTime, deliveryTime, underlying, NOTIONAL); final SwapFuturesPriceDeliverableSecurity futuresConverted = SWAP_FUTURES_SECURITY_DEFINITION.toDerivative(referenceDate); assertEquals("DeliverableSwapFuturesSecurityDefinition: toDerivative", futuresExpected, futuresConverted); }