Package com.opengamma.analytics.financial.interestrate

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


  /**
   * Tests the curve sensitivity for the explicit formula.
   */
  public void presentValueCurveSensitivity() {
    InterestRateCurveSensitivity pvcsSwaption = METHOD_BLACK.presentValueCurveSensitivity(SWAPTION_LONG_REC, CURVES_BLACK);
    pvcsSwaption = pvcsSwaption.cleaned();
    // 1. Forward curve sensitivity
    final DoubleAVLTreeSet forwardTime = new DoubleAVLTreeSet();
    for (int loopcpn = 0; loopcpn < SWAPTION_LONG_REC.getUnderlyingSwap().getSecondLeg().getNumberOfPayments(); loopcpn++) {
      final CouponIbor cpn = (CouponIbor) SWAPTION_LONG_REC.getUnderlyingSwap().getSecondLeg().getNthPayment(loopcpn);
      forwardTime.add(cpn.getFixingPeriodStartTime());
View Full Code Here


    list.add(new DoublesPair(cpnFixed.getPaymentTime(), numeraireDr * numeraireBar));
    final Map<String, List<DoublesPair>> numeraireMap = new HashMap<>();
    numeraireMap.put(cpnFixed.getFundingCurveName(), list);
    InterestRateCurveSensitivity result = new InterestRateCurveSensitivity(numeraireMap);
    result = result.plus(forwardModifiedDr.multipliedBy(forwardModifiedBar));
    result = result.cleaned();
    return result;
  }

  /**
   * Computes the present value sensitivity to the Black volatility (also called vega) of a physical delivery European swaption in the Black swaption model.
View Full Code Here

  /**
   * Tests the curve sensitivity.
   */
  public void presentValueCurveSensitivity() {
    InterestRateCurveSensitivity pvsSwaption = METHOD_HW_APPROXIMATION.presentValueCurveSensitivity(SWAPTION_PAYER_LONG, BUNDLE_HW);
    pvsSwaption = pvsSwaption.cleaned();
    final double deltaTolerancePrice = 1.0E+4;
    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move. Tolerance increased to cope with numerical imprecision of finite difference.
    final double deltaShift = 1.0E-6;
    // 1. Forward curve sensitivity
    final String bumpedCurveName = "Bumped Curve";
View Full Code Here

  /**
   * Tests the present value curve sensitivity vs a finite difference calculation.
   */
  public void parSpreadCurveSensitivity() {
    InterestRateCurveSensitivity pscsComputed = METHOD_COMPOUNDED.presentValueCurveSensitivity(CPN_BEFORE, CURVES_BUNDLE);
    pscsComputed = pscsComputed.cleaned();
    assertEquals("CouponIborCompounded Discounting: present value curve sensitivity", 2, pscsComputed.getSensitivities().size()); // 2 curves
    assertEquals("CouponIborCompounded Discounting: present value curve sensitivity", 1, pscsComputed.getSensitivities().get(CURVES_NAMES[0]).size()); // 1 discounting
    //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;
    // Credit curve sensitivity
View Full Code Here

    HullWhiteMonteCarloMethod methodMC;
    final int nbPath = 50000;
    methodMC = new HullWhiteMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
    // Seed fixed to the DEFAULT_SEED for testing purposes.
    InterestRateCurveSensitivity pvcsMC = methodMC.presentValueCurveSensitivity(ANNUITY_RATCHET_FIXED, CURVES_NAMES[0], BUNDLE_HW);
    pvcsMC = pvcsMC.cleaned(1.0E-10, 1.0E-2); // (1.0E-10, 1.0E-2);

    final PresentValueHullWhiteMonteCarloCalculator calculator = new PresentValueHullWhiteMonteCarloCalculator(nbPath);

    // Dsc curve
    final DoubleAVLTreeSet dscTime = new DoubleAVLTreeSet();
View Full Code Here

    assertEquals(pvsLongPayer.getSensitivities(), pvscLongPayer);
    // Present value sensitivity comparison with finite difference.
    final double deltaTolerance = 1E+2; //Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move.
    final double deltaShift = 1e-9;
    InterestRateCurveSensitivity pvsSwapPayer = new InterestRateCurveSensitivity(SWAP_PAYER.accept(PVSC, sabrBundle));
    pvsSwapPayer = pvsSwapPayer.cleaned();
    InterestRateCurveSensitivity sensi = new InterestRateCurveSensitivity(pvscLongPayer);
    sensi = sensi.cleaned();
    final double pv = SWAPTION_LONG_PAYER.accept(PVC, sabrBundle);
    // 1. Forward curve sensitivity
    final String bumpedCurveName = "Bumped Curve";
View Full Code Here

    final double deltaTolerance = 1E+2; //Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move.
    final double deltaShift = 1e-9;
    InterestRateCurveSensitivity pvsSwapPayer = new InterestRateCurveSensitivity(SWAP_PAYER.accept(PVSC, sabrBundle));
    pvsSwapPayer = pvsSwapPayer.cleaned();
    InterestRateCurveSensitivity sensi = new InterestRateCurveSensitivity(pvscLongPayer);
    sensi = sensi.cleaned();
    final double pv = SWAPTION_LONG_PAYER.accept(PVC, sabrBundle);
    // 1. Forward curve sensitivity
    final String bumpedCurveName = "Bumped Curve";
    final String[] bumpedCurvesForwardName = {FUNDING_CURVE_NAME, bumpedCurveName};
    final SwaptionPhysicalFixedIbor swaptionBumpedForward = SWAPTION_DEFINITION_LONG_PAYER.toDerivative(REFERENCE_DATE, bumpedCurvesForwardName);
View Full Code Here

  /**
   * Tests the price curve sensitivity of CMS coupon and cap/floor using replication in the SABR framework. Values are tested against finite difference values.
   */
  public void presentValueCurveSensitivityCap() {
    InterestRateCurveSensitivity pvcsCap = METHOD.presentValueCurveSensitivity(CMS_CAP, SABR_BUNDLE);
    pvcsCap = pvcsCap.cleaned();
    final double deltaTolerancePrice = 1.0E+2;
    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move.
    final double deltaShift = 1.0E-6;
    final String bumpedCurveName = "Bumped Curve";
    // 1. Forward curve sensitivity
View Full Code Here

  /**
   * Tests the price curve sensitivity of CMS coupon and cap/floor using replication in the SABR framework. Values are tested against finite difference values.
   */
  public void presentValueCurveSensitivityFloor() {
    InterestRateCurveSensitivity pvcsCap = METHOD.presentValueCurveSensitivity(CMS_FLOOR, SABR_BUNDLE);
    pvcsCap = pvcsCap.cleaned();
    final double deltaTolerancePrice = 1.0E+2;
    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move.
    final double deltaShift = 1.0E-6;
    final String bumpedCurveName = "Bumped Curve";
    // 1. Forward curve sensitivity
View Full Code Here

   * Tests the curve sensitivity.
   */
  public void presentValueCurveSensitivity() {

    InterestRateCurveSensitivity pvs = METHOD_HW.presentValueCurveSensitivity(BOND_FUTURE_DERIV, BUNDLE_HW);
    pvs = pvs.cleaned();
    // Bond curve sensitivity
    final DoubleAVLTreeSet bondTime = new DoubleAVLTreeSet();
    bondTime.add(BOND_FUTURE_DERIV.getDeliveryLastTime());
    for (int loopbasket = 0; loopbasket < NB_BOND; loopbasket++) {
      for (int loopcpn = 0; loopcpn < BASKET[loopbasket].getCoupon().getNumberOfPayments(); loopcpn++) {
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.