FloatingStrikeLookbackOptionDefinition extends OptionDefinition { @SuppressWarnings("unchecked") @Override public OptionPayoffFunction<StandardOptionWithSpotTimeSeriesDataBundle> getPayoffFunction() { return _payoffFunction; } FloatingStrikeLookbackOptionDefinition(final Expiry expiry, final boolean isCall); @SuppressWarnings("unchecked") @Override OptionExerciseFunction<StandardOptionWithSpotTimeSeriesDataBundle> getExerciseFunction(); @SuppressWarnings("unchecked") @Override OptionPayoffFunction<StandardOptionWithSpotTimeSeriesDataBundle> getPayoffFunction(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDataBundle() { CALL.getPayoffFunction().getPayoff(null, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullTS() { CALL.getPayoffFunction().getPayoff(HIGH_DATA.withSpotTimeSeries(null), null); }
@Test public void testPayoff() { final double eps = 1e-15; OptionPayoffFunction<StandardOptionWithSpotTimeSeriesDataBundle> payoff = CALL.getPayoffFunction(); assertEquals(payoff.getPayoff(LOW_DATA, 0.), DIFF, eps); assertEquals(payoff.getPayoff(HIGH_DATA, 0.), 0, eps); payoff = PUT.getPayoffFunction(); assertEquals(payoff.getPayoff(LOW_DATA, 0.), 0, eps); assertEquals(payoff.getPayoff(HIGH_DATA, 0.), DIFF, eps); }