Examples of cleaned()


Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

  /**
   * Tests the par spread curve sensitivity vs a finite difference calculation.
   */
  public void parSpreadCurveSensitivity() {
    InterestRateCurveSensitivity pscsComputed = METHOD_TRANSACTION.parSpreadCurveSensitivity(BILL_TRA, CURVE_BUNDLE);
    pscsComputed = pscsComputed.cleaned();
    assertEquals("Bill Transaction: par spread curve sensitivity", 2, pscsComputed.getSensitivities().size());
    assertEquals("Bill Transaction: par spread curve sensitivity", 1, pscsComputed.getSensitivities().get(NAME_CURVES[0]).size());
    assertEquals("Bill Transaction: par spread sensitivity", 1, pscsComputed.getSensitivities().get(NAME_CURVES[1]).size());
    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 0.01 unit for a 1 bp move.
    final double deltaShift = 1.0E-6;
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

    final List<Integer> instrumentIndex = calibrationEngine.getInstrumentIndex();
    final double[] dPvAmdLambda = new double[nbCal];
    final double[][][] dPvCaldGamma = new double[nbCal][][];
    final double[][] dPvCaldLambda = new double[nbCal][nbCal];
    InterestRateCurveSensitivity pvcsCal = METHOD_SWAPTION_LMM.presentValueCurveSensitivity(swaption, lmmBundle);
    pvcsCal = pvcsCal.cleaned();
    final double[][] dPvAmdGamma = METHOD_SWAPTION_LMM.presentValueLMMSensitivity(swaption, lmmBundle);
    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      dPvCaldGamma[loopcal] = METHOD_SWAPTION_LMM.presentValueLMMSensitivity(swaptionCalibration[loopcal], lmmBundle);
    }
    // Multiplicative-factor sensitivity
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

    }
    InterestRateCurveSensitivity pvcsAdjust = new InterestRateCurveSensitivity();
    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      pvcsAdjust = pvcsAdjust.plus(dLambdadC[loopcal].multipliedBy(dPvAmdLambda[loopcal]));
    }
    pvcsAdjust = pvcsAdjust.cleaned();
    InterestRateCurveSensitivity pvcsTot = pvcsCal.plus(pvcsAdjust);
    pvcsTot = pvcsTot.cleaned();
    return pvcsTot;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      pvcsAdjust = pvcsAdjust.plus(dLambdadC[loopcal].multipliedBy(dPvAmdLambda[loopcal]));
    }
    pvcsAdjust = pvcsAdjust.cleaned();
    InterestRateCurveSensitivity pvcsTot = pvcsCal.plus(pvcsAdjust);
    pvcsTot = pvcsTot.cleaned();
    return pvcsTot;
  }

  private static final class VolatilityLMMAngle extends Function1D<Double, Double[]> {
    /**
 
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

    final double[] dPvAmdLambda = new double[nbCal];
    final double[][][] dPvCaldGamma = new double[nbCal][][];
    final double[][] dPvCaldLambda = new double[nbCal][nbCal];
    final PresentValueSABRSensitivityDataBundle[] dPvCaldSABR = new PresentValueSABRSensitivityDataBundle[nbCal];
    InterestRateCurveSensitivity pvcsCal = METHOD_SWAPTION_LMM.presentValueCurveSensitivity(swaption, lmmBundle);
    pvcsCal = pvcsCal.cleaned();
    final double[][] dPvAmdGamma = METHOD_SWAPTION_LMM.presentValueLMMSensitivity(swaption, lmmBundle);
    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      dPvCaldGamma[loopcal] = METHOD_SWAPTION_LMM.presentValueLMMSensitivity(swaptionCalibration[loopcal], lmmBundle);
    }
    // Multiplicative-factor sensitivity
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

    InterestRateCurveSensitivity pvcs = new InterestRateCurveSensitivity();
    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      pvcs = pvcs.plus(dLambdadC[loopcal].multipliedBy(dPvAmdLambda[loopcal]));
    }
    pvcs = pvcs.plus(pvcsCal);
    pvcs = pvcs.cleaned();
    final List<Object> results = new ArrayList<>();
    results.add(CurrencyAmount.of(swaption.getCurrency(), METHOD_SWAPTION_LMM.presentValue(swaption, lmmBundle).getAmount()));
    results.add(pvcs);
    results.add(pvss);
    return results;
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

  public DoubleMatrix1D calculateSensitivity(final InstrumentDerivative instrument, final Set<String> fixedCurves, final YieldCurveBundle bundle) {
    ArgumentChecker.notNull(instrument, "null InterestRateDerivative");
    ArgumentChecker.notNull(fixedCurves, "null set of fixed curves.");
    ArgumentChecker.notNull(bundle, "null bundle");
    InterestRateCurveSensitivity sensitivity = instrument.accept(_curveSensitivityCalculator, bundle);
    sensitivity = sensitivity.cleaned(); // TODO: for testing purposes mainly. Could be removed after the tests.
    return pointToParameterSensitivity(sensitivity, fixedCurves, bundle);
  }

  /**
   * Computes the sensitivity with respect to the parameters from the point sensitivities to the continuously compounded rate.
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

  }

  @Test
  public void dirtyPriceCurveSensitivity() {
    InterestRateCurveSensitivity sensi = METHOD.dirtyPriceCurveSensitivity(BOND_FIXED_SECURITY_1, CURVES);
    sensi = sensi.cleaned();
    final double pv = METHOD.presentValue(BOND_FIXED_SECURITY_1, CURVES);
    final double dfSettle = CURVES.getCurve(REPO_CURVE_NAME).getDiscountFactor(BOND_FIXED_SECURITY_1.getSettlementTime());
    assertEquals("Fixed coupon bond security: dirty price curve sensitivity: repo curve", BOND_FIXED_SECURITY_1.getSettlementTime(), sensi.getSensitivities().get(REPO_CURVE_NAME).get(0).first, 1E-8);
    assertEquals("Fixed coupon bond security: dirty price curve sensitivity: repo curve", BOND_FIXED_SECURITY_1.getSettlementTime() / dfSettle * pv / NOTIONAL,
        sensi.getSensitivities().get(REPO_CURVE_NAME).get(0).second, 1E-8);
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

  }

  @Test
  public void presentValueCurveSensitivity() {
    InterestRateCurveSensitivity pvcsComputed = METHOD_CPN_IBOR_SPREAD.presentValueCurveSensitivity(CPN_IBOR_SPREAD, CURVES);
    pvcsComputed = pvcsComputed.cleaned();
    final InterestRateCurveSensitivity pvcsIbor = METHOD_CPN_IBOR.presentValueCurveSensitivity(CPN_IBOR, CURVES);
    final InterestRateCurveSensitivity pvcsFixed = METHOD_FIXED.presentValueCurveSensitivity(CPN_FIXED, CURVES);
    final InterestRateCurveSensitivity pvcsExpected = pvcsIbor.plus(pvcsFixed).cleaned();
    AssertSensivityObjects.assertEquals("CouponIborSpreadDiscountingMethod: present value curve sensitivity", pvcsExpected, pvcsComputed, TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.cleaned()

  }

  @Test
  public void parRateCurveSensitivity() {
    InterestRateCurveSensitivity prcsComputed = METHOD_CPN_IBOR_SPREAD.parRateCurveSensitivity(CPN_IBOR_SPREAD, CURVES);
    prcsComputed = prcsComputed.cleaned();
    InterestRateCurveSensitivity prcsIbor = METHOD_CPN_IBOR.parRateCurveSensitivity(CPN_IBOR, CURVES);
    prcsIbor = prcsIbor.cleaned();
    AssertSensivityObjects.assertEquals("CouponIborSpreadDiscountingMethod: present value curve sensitivity", prcsIbor, prcsComputed, TOLERANCE_PV);
  }
}
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.