Package com.opengamma.analytics.financial.model.option.definition

Examples of com.opengamma.analytics.financial.model.option.definition.CashOrNothingOptionDefinition


    final StandardOptionDataBundle data = DATA.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0)));
    Function1D<StandardOptionDataBundle, Double> f = MODEL.getPricingFunction(PUT);
    final double df = Math.exp(-R * T);
    assertEquals(f.evaluate(data.withSpot(STRIKE - delta)), df * PAYMENT, EPS);
    assertEquals(f.evaluate(data.withSpot(STRIKE + delta)), 0, EPS);
    final CashOrNothingOptionDefinition call = new CashOrNothingOptionDefinition(STRIKE, EXPIRY, true, PAYMENT);
    f = MODEL.getPricingFunction(call);
    assertEquals(f.evaluate(data.withSpot(STRIKE + delta)), df * PAYMENT, EPS);
    assertEquals(f.evaluate(data.withSpot(STRIKE - delta)), 0, EPS);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.option.definition.CashOrNothingOptionDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.