Package com.opengamma.analytics.financial.model.option.definition

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaParameters


  @Override
  public SmileDeltaParameters getSmile(final Currency ccy1, final Currency ccy2, final double time) {
    ArgumentChecker.notNull(ccy1, "first currency");
    ArgumentChecker.notNull(ccy2, "second currency");
    ArgumentChecker.isTrue(checkCurrencies(ccy1, ccy2), "Incomptabile currencies");
    final SmileDeltaParameters smile = _smile.getSmileForTime(time);
    if (ccy1.equals(getCurrencyPair().getFirst()) && ccy2.equals(getCurrencyPair().getSecond())) {
      return smile;
    }
    throw new NotImplementedException("Currency pair is not in expected order " + getCurrencyPair().toString());
  }
View Full Code Here


      final double[] s = new double[n];
      for (int j = 0; j < n; j++) {
        rr[j] = RR[j][i];
        s[j] = STRANGLE[j][i];
      }
      final SmileDeltaParameters cal = new SmileDeltaParameters(EXPIRIES[i], ATM[i], DELTAS, rr, s);
      assertArrayEquals(cal.getStrike(FORWARD_CURVE.getForward(EXPIRIES[i])), DATA.getStrikes()[i], EPS);
      assertArrayEquals(cal.getVolatility(), DATA.getVolatilities()[i], EPS);
    }
    assertEquals(FORWARD_CURVE, DATA.getForwardCurve());
    //   assertEquals(IS_CALL_DATA, DATA.isCallData());
    ForexSmileDeltaSurfaceDataBundle other = new ForexSmileDeltaSurfaceDataBundle(FORWARD_CURVE, EXPIRIES, DELTAS, ATM, RR, STRANGLE, IS_CALL_DATA);
    assertEquals(DATA, other);
View Full Code Here

    ArgumentChecker.isTrue(volatility.length == nbExp, "Volatility array length {} should be equal to the number of expiries {}", volatility.length, nbExp);
    ArgumentChecker.isTrue(volatility[0].length == 2 * delta.length + 1, "Volatility array {} should be equal to (2 * number of deltas) + 1, have {}", volatility[0].length, 2 * delta.length + 1);
    _timeToExpiration = timeToExpiration;
    _volatilityTerm = new SmileDeltaParameters[nbExp];
    for (int loopexp = 0; loopexp < nbExp; loopexp++) {
      _volatilityTerm[loopexp] = new SmileDeltaParameters(timeToExpiration[loopexp], delta, volatility[loopexp]);
    }
    _timeInterpolator = DEFAULT_INTERPOLATOR_EXPIRY;
    ArgumentChecker.isTrue(_volatilityTerm[0].getVolatility().length > 1, "Need more than one volatility value to perform interpolation");
  }
View Full Code Here

    ArgumentChecker.isTrue(riskReversal[0].length == delta.length, "Risk reversal size should be coherent with time to delta length");
    ArgumentChecker.isTrue(strangle[0].length == delta.length, "Risk reversal size should be coherent with time to delta length");
    _timeToExpiration = timeToExpiration;
    _volatilityTerm = new SmileDeltaParameters[nbExp];
    for (int loopexp = 0; loopexp < nbExp; loopexp++) {
      _volatilityTerm[loopexp] = new SmileDeltaParameters(timeToExpiration[loopexp], atm[loopexp], delta, riskReversal[loopexp], strangle[loopexp]);
    }
    _timeInterpolator = timeInterpolator;
    ArgumentChecker.isTrue(_volatilityTerm[0].getVolatility().length > 1, "Need more than one volatility value to perform interpolation");
  }
View Full Code Here

        volDelta[looptime] = _volatilityTerm[looptime].getVolatility()[loopvol];
      }
      final ArrayInterpolator1DDataBundle interpData = new ArrayInterpolator1DDataBundle(_timeToExpiration, volDelta, true);
      volatilityT[loopvol] = _timeInterpolator.interpolate(interpData, time);
    }
    final SmileDeltaParameters smile = new SmileDeltaParameters(time, _volatilityTerm[0].getDelta(), volatilityT);
    return smile;
  }
View Full Code Here

      for (int looptime = 0; looptime < nbTime; looptime++) {
        volatilitySensitivity[looptime][loopvol] = volatilitySensitivityVol[looptime] * volatilityAtTimeSensitivity[loopvol];
      }
      volatilityT[loopvol] = _timeInterpolator.interpolate(interpData, time);
    }
    final SmileDeltaParameters smile = new SmileDeltaParameters(time, _volatilityTerm[0].getDelta(), volatilityT);
    return new SmileAndBucketedSensitivities(smile, volatilitySensitivity);
  }
View Full Code Here

   * @param forward The forward.
   * @return The volatility.
   */
  public double getVolatility(final double time, final double strike, final double forward) {
    ArgumentChecker.isTrue(time >= 0, "Positive time");
    final SmileDeltaParameters smile = getSmileForTime(time);
    final double[] strikes = smile.getStrike(forward);
    final Interpolator1DDataBundle volatilityInterpolation = _strikeInterpolator.getDataBundle(strikes, smile.getVolatility());
    final double volatility = _strikeInterpolator.interpolate(volatilityInterpolation, strike);
    return volatility;
  }
View Full Code Here

   * Only the lines of impacted dates are changed. The input data on the other lines will not be changed.
   * @return The volatility.
   */
  public VolatilityAndBucketedSensitivities getVolatilityAndSensitivities(final double time, final double strike, final double forward) {
    ArgumentChecker.isTrue(time >= 0, "Positive time");
    final SmileDeltaParameters smile = getSmileForTime(time);
    final double[] strikes = smile.getStrike(forward);
    final Interpolator1DDataBundle volatilityInterpolation = _strikeInterpolator.getDataBundle(strikes, smile.getVolatility());
    final double volatility = _strikeInterpolator.interpolate(volatilityInterpolation, strike);
    // Backward sweep
    final double[] smileVolatilityBar = _strikeInterpolator.getNodeSensitivitiesForValue(volatilityInterpolation, strike);
    final SmileAndBucketedSensitivities smileAndSensitivities = getSmileAndSensitivitiesForTime(time, smileVolatilityBar);
    return new VolatilityAndBucketedSensitivities(volatility, smileAndSensitivities.getBucketedSensitivities());
View Full Code Here

      final double[] s = new double[n];
      for (int j = 0; j < n; j++) {
        rr[j] = riskReversals[j][i];
        s[j] = strangle[j][i];
      }
      final SmileDeltaParameters cal = new SmileDeltaParameters(_expiries[i], atms[i], deltas, rr, s);
      _strikes[i] = cal.getStrike(_forwards[i]);
      _vols[i] = cal.getVolatility();
    }
    _isCallData = isCallData;
    checkVolatilities(expiries, _vols);
  }
View Full Code Here

      final double[] s = new double[n];
      for (int j = 0; j < n; j++) {
        rr[j] = riskReversals[j][i];
        s[j] = strangle[j][i];
      }
      final SmileDeltaParameters cal = new SmileDeltaParameters(_expiries[i], atms[i], deltas, rr, s);
      _strikes[i] = cal.getStrike(_forwards[i]);
      _vols[i] = cal.getVolatility();
    }
    _isCallData = isCallData;
    checkVolatilities(expiries, _vols);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.option.definition.SmileDeltaParameters

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.