SwapFuturesPriceDeliverableSecurityDefinition extends FuturesSecurityDefinition<SwapFuturesPriceDeliverableSecurity> { public static SwapFuturesPriceDeliverableSecurityDefinition from(final ZonedDateTime effectiveDate, final GeneratorSwapFixedIbor generator, final Period tenor, final double notional, final double rate) { ArgumentChecker.notNull(effectiveDate, "Effective date"); ArgumentChecker.notNull(generator, "Generator"); final ZonedDateTime lastTradingDate = ScheduleCalculator.getAdjustedDate(effectiveDate, -generator.getSpotLag(), generator.getCalendar()); final SwapFixedIborDefinition swap = SwapFixedIborDefinition.from(effectiveDate, tenor, generator, 1.0, rate, false); return new SwapFuturesPriceDeliverableSecurityDefinition(lastTradingDate, swap, 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(expectedExceptions = IllegalArgumentException.class) public void wrongSwap1() { new SwapFuturesPriceDeliverableSecurityDefinition(LAST_TRADING_DATE, SwapFixedIborDefinition.from(EFFECTIVE_DATE, TENOR, USD6MLIBOR3M, 2.0, RATE, false), NOTIONAL); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongSwap2() { new SwapFuturesPriceDeliverableSecurityDefinition(LAST_TRADING_DATE, SwapFixedIborDefinition.from(EFFECTIVE_DATE, TENOR, USD6MLIBOR3M, 1.0, RATE, true), NOTIONAL); }
@Test public void from() { final SwapFuturesPriceDeliverableSecurityDefinition futuresDefinition = SwapFuturesPriceDeliverableSecurityDefinition.from(EFFECTIVE_DATE, USD6MLIBOR3M, TENOR, NOTIONAL, RATE); assertEquals("DeliverableSwapFuturesSecurityDefinition: from", SWAP_FUTURES_SECURITY_DEFINITION, futuresDefinition); }