Examples of withCostOfCarry()


Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionWithSpotTimeSeriesDataBundle.withCostOfCarry()

    double strike = 102;
    DoubleTimeSeries<?> shortTS = ImmutableInstantDoubleTimeSeries.of(new long[] {1}, new double[] {strike});
    StandardOptionWithSpotTimeSeriesDataBundle data = DATA.withSpotTimeSeries(shortTS).withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0)));
    OptionDefinition vanilla = new EuropeanVanillaOptionDefinition(strike, EXPIRY, true);
    assertEquals(MODEL.getPricingFunction(CALL).evaluate(data), BSM.getPricingFunction(vanilla).evaluate(data), 1e-9);
    data = data.withCostOfCarry(0);
    assertEquals(MODEL.getPricingFunction(CALL).evaluate(data), BSM.getPricingFunction(vanilla).evaluate(data), 1e-9);
    strike = 95;
    shortTS = ImmutableInstantDoubleTimeSeries.of(new long[] {1}, new double[] {strike});
    data = DATA.withSpotTimeSeries(shortTS).withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0)));
    vanilla = new EuropeanVanillaOptionDefinition(strike, EXPIRY, false);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.StandardOptionWithSpotTimeSeriesDataBundle.withCostOfCarry()

    strike = 95;
    shortTS = ImmutableInstantDoubleTimeSeries.of(new long[] {1}, new double[] {strike});
    data = DATA.withSpotTimeSeries(shortTS).withVolatilitySurface(new VolatilitySurface(ConstantDoublesSurface.from(0)));
    vanilla = new EuropeanVanillaOptionDefinition(strike, EXPIRY, false);
    assertEquals(MODEL.getPricingFunction(PUT).evaluate(data), BSM.getPricingFunction(vanilla).evaluate(data), 1e-9);
    data = data.withCostOfCarry(0);
    assertEquals(MODEL.getPricingFunction(PUT).evaluate(data), BSM.getPricingFunction(vanilla).evaluate(data), 1e-9);
    assertEquals(MODEL.getPricingFunction(CALL).evaluate(DATA), 25.3533, 1e-4);
  }
}
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.