Examples of SuccessiveRootFinderG2ppCalibrationObjective


Examples of com.opengamma.analytics.financial.provider.method.SuccessiveRootFinderG2ppCalibrationObjective

  public void calibration() {
    final double[] meanReversion = new double[] {0.01, 0.30 };
    final double ratio = 4.0;
    final double correlation = -0.50;
    final G2ppPiecewiseConstantParameters g2Parameters = new G2ppPiecewiseConstantParameters(meanReversion, new double[][] { {0.01 }, {0.01 / ratio } }, new double[0], correlation);
    final SuccessiveRootFinderG2ppCalibrationObjective objective = new SuccessiveRootFinderG2ppCalibrationObjective(g2Parameters, EUR, ratio);
    final SuccessiveRootFinderG2ppCalibrationEngine<SABRSwaptionProviderInterface> calibrationEngine = new SuccessiveRootFinderG2ppCalibrationEngine<>(objective);

    for (int loopexp = 0; loopexp < EXPIRY_TENOR.length; loopexp++) {
      calibrationEngine.addInstrument(SWAPTION_LONG_PAYER[loopexp], PVSSC);
    }
    calibrationEngine.calibrate(SABR_MULTICURVES);
    final MultipleCurrencyAmount[] pvSabr = new MultipleCurrencyAmount[EXPIRY_TENOR.length];
    final MultipleCurrencyAmount[] pvHw = new MultipleCurrencyAmount[EXPIRY_TENOR.length];
    for (int loopexp = 0; loopexp < EXPIRY_TENOR.length; loopexp++) {
      pvSabr[loopexp] = SWAPTION_LONG_PAYER[loopexp].accept(PVSSC, SABR_MULTICURVES);
      pvHw[loopexp] = METHOD_G2PP.presentValue(SWAPTION_LONG_PAYER[loopexp], objective.getG2Provider());
      assertEquals("G2++ calibration: swaption " + loopexp, pvSabr[loopexp].getAmount(EUR), pvHw[loopexp].getAmount(EUR), TOLERANCE_PV);
    }
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.method.SuccessiveRootFinderG2ppCalibrationObjective

    final MultipleCurrencyAmount[] pv = new MultipleCurrencyAmount[nbTest];

    startTime = System.currentTimeMillis();
    for (int looptest = 0; looptest < nbTest; looptest++) {
      final G2ppPiecewiseConstantParameters g2Parameters = new G2ppPiecewiseConstantParameters(meanReversion, new double[][] { {0.01 }, {0.01 / ratio } }, new double[0], correlation);
      final SuccessiveRootFinderG2ppCalibrationObjective objective = new SuccessiveRootFinderG2ppCalibrationObjective(g2Parameters, EUR, ratio);
      final SuccessiveRootFinderG2ppCalibrationEngine<SABRSwaptionProviderInterface> calibrationEngine = new SuccessiveRootFinderG2ppCalibrationEngine<>(objective);
      for (int loopexp = 0; loopexp < EXPIRY_TENOR.length; loopexp++) {
        calibrationEngine.addInstrument(SWAPTION_LONG_PAYER[loopexp], PVSSC);
      }
      calibrationEngine.calibrate(SABR_MULTICURVES);
      pv[looptest] = METHOD_G2PP.presentValue(SWAPTION_LONG_PAYER[EXPIRY_TENOR.length - 1], objective.getG2Provider());
    }
    endTime = System.currentTimeMillis();
    System.out.println(nbTest + " G2++ calibration to swaption (5 swaptions) + price: " + (endTime - startTime) + " ms");
    // Performance note: calibration: 12-Dec-2012: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 550 ms for 100 calibration with 5 swaptions.
    // TODO: Why is the time 4x the one with "CurveBundle"?
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.