Examples of withFirstVolatilitySurface()


Examples of com.opengamma.analytics.financial.model.option.definition.twoasset.StandardTwoAssetOptionDataBundle.withFirstVolatilitySurface()

  public void test() {
    ProductOptionDefinition option = new ProductOptionDefinition(15000, EXPIRY1, true);
    StandardTwoAssetOptionDataBundle data = new StandardTwoAssetOptionDataBundle(R, B1, B2, new VolatilitySurface(ConstantDoublesSurface.from(0.2)), new VolatilitySurface(
        ConstantDoublesSurface.from(0.3)), S1, S2, -0.5, DATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 0.0028, EPS);
    data = data.withFirstVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0.3))).withCorrelation(0);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 2.4026, EPS);
    option = new ProductOptionDefinition(15000, EXPIRY2, true);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 266.1594, EPS);
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.