BondFuturesOptionPremiumTransactionDefinition implements InstrumentDefinition<BondFuturesOptionPremiumTransaction> { public static BondFuturesOptionPremiumTransactionDefinition fromTradePrice(final BondFuturesOptionPremiumSecurityDefinition underlyingOption, final int quantity, final ZonedDateTime premiumDate, final double tradePrice) { ArgumentChecker.notNull(underlyingOption, "underlying option"); final double premiumAmount = tradePrice * underlyingOption.getUnderlyingFuture().getNotional() * quantity; return new BondFuturesOptionPremiumTransactionDefinition(underlyingOption, quantity, premiumDate, premiumAmount); } BondFuturesOptionPremiumTransactionDefinition(final BondFuturesOptionPremiumSecurityDefinition underlyingOption, final int quantity,
      final ZonedDateTime premiumDate, final double premiumAmount); static BondFuturesOptionPremiumTransactionDefinition fromTradePrice(final BondFuturesOptionPremiumSecurityDefinition underlyingOption, final int quantity,
      final ZonedDateTime premiumDate, final double tradePrice); BondFuturesOptionPremiumSecurityDefinition getUnderlyingOption(); int getQuantity(); double getTradePrice(); PaymentFixedDefinition getPremium(); Currency getCurrency(); @Override BondFuturesOptionPremiumTransaction 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 fromTradePrice() { final BondFuturesOptionPremiumTransactionDefinition from = BondFuturesOptionPremiumTransactionDefinition.fromTradePrice(FVU1_C120_SEC_DEFINITION, QUANTITY, PREMIUM_DATE, TRANSACTION_PRICE); assertEquals("Bond future option premium transaction definition", from.getPremium().getReferenceAmount(), PREMIUM_AMOUNT); assertEquals("Bond future option premium transaction definition", from, FVU1_C120_TR_DEFINITION); }