Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.NodeYieldSensitivityCalculator


    final YieldCurve discCrv = (YieldCurve) market.getDiscountCurve();

    final double settlement = derivative.accept(SETTLEMENT_CALCULATOR);
    final double sens = calcDiscountRateSensitivity(derivative, market);

    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    final List<Double> result = distributor.curveToNodeSensitivity(Arrays.asList(DoublesPair.of(settlement, sens)), discCrv);
    return new DoubleMatrix1D(result.toArray(new Double[result.size()]));
  }
View Full Code Here


    final double pvUp = future.accept(_presentValueCalculator, bumpedMarket);
    bumpedMarket = new SimpleFutureDataBundle(discCrv.withSingleShift(settlement, -SHIFT), dataBundle.getMarketPrice(),
        dataBundle.getSpotValue(), dataBundle.getDividendYield(), dataBundle.getCostOfCarry());
    final double pvDown = future.accept(_presentValueCalculator, bumpedMarket);
    final double sensitivity = (pvUp - pvDown) / (2.0 * SHIFT);
    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    final List<Double> result = distributor.curveToNodeSensitivity(Arrays.asList(DoublesPair.of(settlement, sensitivity)), discCrv);
    return new DoubleMatrix1D(result.toArray(new Double[result.size()]));
  }
View Full Code Here

      throw new IllegalArgumentException("Can only handle YieldCurve");
    }
    final double settlement = swap.getTimeToSettlement();
    final double sens = calcDiscountRateSensitivity(swap, market);

    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    final List<Double> result = distributor.curveToNodeSensitivity(Arrays.asList(DoublesPair.of(settlement, sens)), (YieldCurve) discCrv);
    return new DoubleMatrix1D(result.toArray(new Double[result.size()]));
  }
View Full Code Here

    ArgumentChecker.isTrue(dataBundle.getFundingCurve() instanceof YieldCurve, "Calculator expects a YieldCurve, have {}", dataBundle.getFundingCurve().getClass());
    final YieldCurve discCrv = (YieldCurve) dataBundle.getFundingCurve();
    final double settlement = future.accept(SETTLEMENT_TIME);
    final double rhoSettle = -1 * settlement * future.accept(_presentValueCalculator, dataBundle);
    //  We use PresentValueNodeSensitivityCalculator to distribute this risk across the curve
    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    final List<Double> result = distributor.curveToNodeSensitivity(Arrays.asList(DoublesPair.of(settlement, rhoSettle)), discCrv);
    return new DoubleMatrix1D(result.toArray(new Double[result.size()]));

  }
View Full Code Here

      settle = ((EquityOption) derivative).getTimeToSettlement();
      final EquityOptionBlackMethod model = EquityOptionBlackMethod.getInstance();
      rhoSettle = -1 * settle * model.presentValue((EquityOption) derivative, market);
    }
    //  We use PresentValueNodeSensitivityCalculator to distribute this risk across the curve
    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    // What's left is to package up the inputs to the distributor, a YieldCurveBundle and a Map of Sensitivities
    final Map<String, List<DoublesPair>> curveSensMap = new HashMap<>();
    curveSensMap.put(fundingCurveName, Lists.newArrayList(new DoublesPair(settle, rhoSettle)));
    sensVector = distributor.curveToNodeSensitivities(curveSensMap, curveBundle);

    // Build up InstrumentLabelledSensitivities for the Curve
    final Object curveSpecObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_SPEC);
    if (curveSpecObject == null) {
      throw new OpenGammaRuntimeException("Curve specification was null");
View Full Code Here

      if (settlementTime < 0.0) {
        throw new OpenGammaRuntimeException("EquityBarrierOptionSecurity has already settled.");
      }
      final double rhoSettle = -1 * settlementTime * pv;
      //  We use PresentValueNodeSensitivityCalculator to distribute this risk across the curve
      final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
      // What's left is to package up the inputs to the distributor, a YieldCurveBundle and a Map of Sensitivities
      final Map<String, List<DoublesPair>> curveSensMap = new HashMap<>();
      curveSensMap.put(fundingCurveName, Lists.newArrayList(new DoublesPair(settlementTime, rhoSettle)));
      sensVector = distributor.curveToNodeSensitivities(curveSensMap, curveBundle);
    } else {
      throw new IllegalArgumentException("YieldCurveNodeSensitivities currently available only for Funding Curve backed by a InterpolatedDoublesCurve");
    }
    // Build up InstrumentLabelledSensitivities for the Curve
    final Object curveSpecObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_SPEC);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.NodeYieldSensitivityCalculator

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.