MixedBivariateLogNormalModelVolatility { public double getImpliedVolatilityZ(final EuropeanVanillaOption option, final double forward) { final MixedLogNormalVolatilityFunction volfunc = MixedLogNormalVolatilityFunction.getInstance(); return volfunc.getVolatility(option, forward, _data); } MixedBivariateLogNormalModelVolatility(final double[] weights, final double[] sigmasX, final double[] sigmasY, final double[] rhos);  MixedBivariateLogNormalModelVolatility(final double[] weights, final double[] sigmasX, final double[] sigmasY, final double[] relativePartialForwardsX,
      final double[] relativePartialForwardsY,
      final double[] rhos); double getInvExpDriftCorrection(); double[] getOrderedWeights(); double[] getSigmasZ(); double[] getRelativeForwardsZ(); double getImpliedVolatilityZ(final EuropeanVanillaOption option, final double forward); double getPriceZ(final EuropeanVanillaOption option, final double forward); double[] getOrderedSigmasX(); double[] getOrderedSigmasY(); double[] getOrderedRelativePartialForwardsX(); double[] getOrderedRelativePartialForwardsY();  }
@Test (enabled = false) public void printTest() { final double[] constWeights = {0.8, 0.2 }; final double[] sigmasX = {0.3, 0.4 }; final double[] sigmasY = {0.1, 0.2 }; final double[] relativePartialForwardsX = {1.1, 0.6 }; final double[] relativePartialForwardsY = {1.0, 1.0 }; final double[] rhos = {0.1, 0.8 }; final double[] weights = constWeights; final MixedBivariateLogNormalModelVolatility objZ = new MixedBivariateLogNormalModelVolatility(weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, rhos); final MixedLogNormalModelData objX = new MixedLogNormalModelData(weights, sigmasX, relativePartialForwardsX); final MixedLogNormalModelData objY = new MixedLogNormalModelData(weights, sigmasY, relativePartialForwardsY); final double forwardX = 1.1; final double forwardY = 0.9; final double forwardZ = forwardX / forwardY; final double timeToExpiry = 0.6; final MixedLogNormalVolatilityFunction volfunc = MixedLogNormalVolatilityFunction.getInstance(); for (int i = 0; i < 101; i++) { final double k = forwardZ * (0.5 + 1. * i / 100.); final EuropeanVanillaOption option = new EuropeanVanillaOption(k, timeToExpiry, true); final double vol1 = objZ.getImpliedVolatilityZ(option, forwardZ); final double vol2 = volfunc.getVolatility(option, forwardX, objX); final double vol3 = volfunc.getVolatility(option, forwardY, objY); System.out.println(k + "\t" + vol1 + "\t" + vol2 + "\t" + vol3); } }
@Test (enabled = false) public void printTestStrikeTime() { final double[] constWeights = {0.8, 0.2 }; final double[] sigmasX = {0.3, 0.4 }; final double[] sigmasY = {0.1, 0.2 }; final double[] relativePartialForwardsX = {1.1, 0.6 }; final double[] relativePartialForwardsY = {1.0, 1.0 }; final double[] rhos = {0.1, 0.8 }; final double[] weights = constWeights; final MixedBivariateLogNormalModelVolatility objZ = new MixedBivariateLogNormalModelVolatility(weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, rhos); final double forwardX = 1.1; final double forwardY = 0.9; final double forwardZ = forwardX / forwardY; for (int j = 0; j < 51; j++) { final double time = 0.5 * (0.5 + 2. * j / 100.); for (int i = 0; i < 51; i++) { final double k = forwardZ * (0.5 + 1. * i / 100.); final EuropeanVanillaOption option = new EuropeanVanillaOption(k, time, true); final double vol1 = objZ.getImpliedVolatilityZ(option, forwardZ); System.out.println(k + "\t" + time + "\t" + vol1); } } }