Package com.opengamma.analytics.financial.model.volatility.surface

Examples of com.opengamma.analytics.financial.model.volatility.surface.SmileDeltaTermStructureParameters


   * Create a  copy of the bundle.
   * @return The bundle.
   */
  public SmileDeltaTermStructureVannaVolgaDataBundle copy() {
    final YieldCurveBundle curves = getCurvesCopy();
    final SmileDeltaTermStructureParameters smile = getVolatilityModel().copy();
    final Pair<Currency, Currency> currencyPair = Pair.of(getCurrencyPair().getFirst(), getCurrencyPair().getSecond());
    return new SmileDeltaTermStructureVannaVolgaDataBundle(curves, smile, currencyPair);
  }
View Full Code Here


      final SmileDeltaParameters[] smiles = new SmileDeltaParameters[n];
      for (int i = 0; i < n; i++) {
        smiles[i] = new SmileDeltaParameters(t[i], delta[i], volatility[i]);
      }
      final Interpolator1D interpolator = deserializer.fieldValueToObject(Interpolator1D.class, message.getByName(TIME_INTERPOLATOR_NAME));
      return new SmileDeltaTermStructureParameters(smiles, interpolator);
    }
View Full Code Here

  @Test
  public void test2() {
    final double[] t = {0., 0.5};
    final double[] deltas = {0.8, 0.2};
    final double[][] volatility = new double[][] {new double[] {0.45, 0.35, 0.3, 0.27, 0.22}, new double[] {0.25, 0.15, 0.12, 0.11, 0.1}};
    SmileDeltaTermStructureParameters smiles = new SmileDeltaTermStructureParameters(t, deltas, volatility);
    assertEquals(smiles, cycleObject(SmileDeltaTermStructureParameters.class, smiles));
    final Interpolator1D timeInterpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(Interpolator1DFactory.LOG_LINEAR, Interpolator1DFactory.LINEAR_EXTRAPOLATOR,
        Interpolator1DFactory.FLAT_EXTRAPOLATOR);
    smiles = new SmileDeltaTermStructureParameters(smiles.getVolatilityTerm(), timeInterpolator);
    assertEquals(smiles, cycleObject(SmileDeltaTermStructureParameters.class, smiles));
  }
View Full Code Here

    }
    final Object volatilitySurfaceObject = inputs.getValue(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA);
    if (volatilitySurfaceObject == null) {
      throw new OpenGammaRuntimeException("Could not get volatility surface data");
    }
    final SmileDeltaTermStructureParameters allSmiles = (SmileDeltaTermStructureParameters) volatilitySurfaceObject;
    final double[] uniqueDeltas = allSmiles.getDelta();
    final int putDeltaIndex = Arrays.binarySearch(uniqueDeltas, delta);
    if (putDeltaIndex < 0) {
      throw new OpenGammaRuntimeException("Could not get OTM smile for delta = " + delta);
    }
    final SmileDeltaParameters[] surface = new SmileDeltaParameters[allSmiles.getNumberExpiration()];
    final int atmIndex = (allSmiles.getNumberStrike() - 1) / 2;
    final double[] deltas = {delta };
    for (int i = 0; i < allSmiles.getNumberExpiration(); i++) {
      final SmileDeltaParameters parameters = allSmiles.getSmileForTime(i);
      final double timeToExpiration = parameters.getTimeToExpiry();
      final double[] volatilities = new double[3];
      final double[] allVolatilities = parameters.getVolatility();
      volatilities[0] = allVolatilities[putDeltaIndex];
      volatilities[1] = allVolatilities[atmIndex];
      volatilities[2] = allVolatilities[2 * atmIndex - putDeltaIndex];
      surface[i] = new SmileDeltaParameters(timeToExpiration, deltas, volatilities);
    }
    final Interpolator1D interpolator = allSmiles.getTimeInterpolator();
    final SmileDeltaTermStructureParameters resultSmiles = new SmileDeltaTermStructureParameters(surface, interpolator);
    final Currency ccy1;
    final Currency ccy2;
    final Object spotObject = inputs.getValue(ValueRequirementNames.SPOT_RATE);
    if (spotObject == null) {
      throw new OpenGammaRuntimeException("Could not get spot requirement");
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.volatility.surface.SmileDeltaTermStructureParameters

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.