Examples of Interpolator1DDataBundle


Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

    for (int i = 0; i < n; i++) {
      k[i] = strikeNPrice[i][0];
      vol[i] = BLACK_IMPLIED_VOL.getImpliedVolatility(new BlackFunctionData(FORWARD, DF, 0.0), new EuropeanVanillaOption(k[i], t, isCall), strikeNPrice[i][1]);
    }

    final Interpolator1DDataBundle dataBundle = INTERPOLATOR.getDataBundleFromSortedArrays(k, vol);
    final double[][] strikeNPrice2 = PRICER.price(FORWARD, DF, t, isCall, heston, 0.7 * FORWARD, 1.5 * FORWARD, nStrikes, 0.2, 0.75, 1e-8);
    final int m = strikeNPrice2.length;
    for (int i = 0; i < m; i++) {
      final double strike = strikeNPrice2[i][0];
      final double sigma = BLACK_IMPLIED_VOL.getImpliedVolatility(new BlackFunctionData(FORWARD, DF, 0.0), new EuropeanVanillaOption(strike, t, isCall), strikeNPrice2[i][1]);
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

      @SuppressWarnings("synthetic-access")
      @Override
      public DoubleMatrix2D evaluate(final DoubleMatrix1D x) {

        final Interpolator1DDataBundle db = _interpolator.getDataBundle(_knots, x.getData());

        final double[] capletVols = new double[nCaplets];
        final double[][] sense = new double[nCaplets][];
        for (int i = 0; i < nCaplets; i++) {
          capletVols[i] = _interpolator.interpolate(db, capletExp[i]);
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

   */
  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

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

   */
  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

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

            validVols = vol;
          } else {
            validStrikes = Arrays.copyOfRange(k, 0, count);
            validVols = Arrays.copyOfRange(vol, 0, count);
          }
          final Interpolator1DDataBundle dataBundle = _interpolator.getDataBundleFromSortedArrays(validStrikes, validVols);
          for (int i = 0; i < n; i++) {
            res[i] = _interpolator.interpolate(dataBundle, strikes[i]);
          }
        }
        return res;
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

        }
        for (int i = 0; i < m; i++) {
          vega[i] = BlackFormulaRepository.vega(forward, k[i], timeToExpiry, vols[i]);
        }

        final Interpolator1DDataBundle dataBundle = _interpolator.getDataBundleFromSortedArrays(k, vols);

        for (int i = 0; i < n; i++) {
          nodeSense[i] = _interpolator.getNodeSensitivitiesForValue(dataBundle, strikes[i]);
        }
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

          for (int j = 0; j < 5; j++) {
            validModelGreeks[j] = Arrays.copyOfRange(modelGreeks[j], 0, count);
          }
        }

        final Interpolator1DDataBundle dataBundle = _interpolator.getDataBundleFromSortedArrays(validStrikes, validVols);

        for (int i = 0; i < n; i++) {
          nodeSense[i] = _interpolator.getNodeSensitivitiesForValue(dataBundle, strikes[i]);
        }
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

            y *= time;
          }
          yData[i] = _useLogVar ? Math.log(y) : y;
        }

        final Interpolator1DDataBundle db = _timeInterpolator.getDataBundle(xData, yData);
        final double tRes = _timeInterpolator.interpolate(db, x);
        final double yValue = _useLogVar ? Math.exp(tRes) : tRes;
        final double res = Math.sqrt(yValue / (_useIntegratedVariance ? t : 1.0));

        return res;
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

    } catch (final FunctionEvaluationException ex) {
      // TODO Auto-generated catch block
      ex.printStackTrace();
    }

    final Interpolator1DDataBundle dataBundle = getDataBundleFromSortedArrays(nodes, values);
    final StepInterpolator1D stepInterpolator = new StepInterpolator1D();

    return stepInterpolator.interpolate(dataBundle, value);

  }
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.data.Interpolator1DDataBundle

    for (int i = 0; i < n; i++) {
      x[i] = Math.log(strikes[i] / forward);
    }

    // Interpolator
    final Interpolator1DDataBundle data = _interpolator.getDataBundle(x, impliedVols);

    final Function1D<Double, Double> interpFunc = new Function1D<Double, Double>() {
      @SuppressWarnings("synthetic-access")
      @Override
      public Double evaluate(final Double k) {
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.