Examples of withSpot()


Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    assertResult(model.getGreeks(put, vars, GREEK_SET), 4.0628, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 1.0689, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA2))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 12.4097, eps);
    vars = vars.withSpot(SPOT2);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 6.7661, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 3.2932, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA3))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 14.6445, eps);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    assertResult(model.getGreeks(put, vars, GREEK_SET), 1.0689, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA2))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 12.4097, eps);
    vars = vars.withSpot(SPOT2);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 6.7661, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 3.2932, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA3))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 14.6445, eps);
    vars = vars.withSpot(SPOT2);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 9.4608, eps);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    assertResult(model.getGreeks(put, vars, GREEK_SET), 6.7661, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 3.2932, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA3))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 14.6445, eps);
    vars = vars.withSpot(SPOT2);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 9.4608, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 5.8374, eps);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    assertResult(model.getGreeks(put, vars, GREEK_SET), 3.2932, eps);
    vars = vars.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(SIGMA3))).withSpot(SPOT1);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 14.6445, eps);
    vars = vars.withSpot(SPOT2);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 9.4608, eps);
    vars = vars.withSpot(SPOT3);
    assertResult(model.getGreeks(put, vars, GREEK_SET), 5.8374, eps);
  }

  private void assertResult(final GreekResultCollection result, final double value, final double eps) {
    assertEquals(result.get(Greek.FAIR_PRICE), value, eps);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

  @Test
  public void testZeroVol() {
    StandardOptionDataBundle data = DATA.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(1e-15))).withSpot(LOWER - 1);
    assertEquals(MODEL.getPricingFunction(OPTION).evaluate(data), 0, 0);
    data = data.withSpot(UPPER + 1);
    assertEquals(MODEL.getPricingFunction(OPTION).evaluate(data), 0, 0);
  }

  @Test
  public void test() {
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

  public void testZeroVol() {
    final double delta = 20;
    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

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    final double delta = 20;
    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

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    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);
  }

  @Test
  public void test() {
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

    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);
  }

  @Test
  public void test() {
    assertEquals(MODEL.getPricingFunction(PUT).evaluate(DATA), 2.6710, 1e-4);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionDataBundle.withSpot()

  public void testZeroVol() {
    StandardOptionDataBundle data = DATA.withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0)));
    final double df = Math.exp(T * (B - R));
    assertEquals(MODEL.getPricingFunction(CALL).evaluate(data), df * SPOT, EPS);
    assertEquals(MODEL.getPricingFunction(PUT).evaluate(data), 0, 0);
    data = data.withSpot(60);
    assertEquals(MODEL.getPricingFunction(CALL).evaluate(data), 0, 0);
    assertEquals(MODEL.getPricingFunction(PUT).evaluate(data), df * 60, EPS);
  }

  @Test
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.