Package com.opengamma.analytics.financial.provider.sensitivity.multicurve

Examples of com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity


   */
  public Map<String, List<DoublesPair>> calculatePriceSensitivityToCurve(final Annuity<? extends Payment> annuity, final T curves, final double zSpread) {
    ArgumentChecker.notNull(annuity, "annuity");
    ArgumentChecker.notNull(curves, "curves");

    final MultipleCurrencyMulticurveSensitivity pvss = annuity.accept(_pvSensitivityCalculator, curves);
    final Set<Currency> currencies = pvss.getCurrencies();
    if (currencies.size() != 1) {
      throw new IllegalStateException("Had more than one currency in result: " + pvss.getCurrencies());
    }
    final MulticurveSensitivity sensitivities = pvss.getSensitivity(Iterables.getOnlyElement(currencies));
    if (Double.doubleToLongBits(zSpread) == 0) {
      return sensitivities.getYieldDiscountingSensitivities();
    }
    final Map<String, List<DoublesPair>> result = new HashMap<>();
    for (final Map.Entry<String, List<DoublesPair>> entry : sensitivities.getYieldDiscountingSensitivities().entrySet()) {
View Full Code Here


    ArgumentChecker.notNull(curves, "curves");

    final double dPricedZ = calculatePriceSensitivityToZSpread(annuity, curves, zSpread);
    ArgumentChecker.isTrue(Double.doubleToLongBits(dPricedZ) != 0, "Price Sensitivity To ZSpread is zero");

    final MultipleCurrencyMulticurveSensitivity pvss = annuity.accept(_pvSensitivityCalculator, curves);
    final Set<Currency> currencies = pvss.getCurrencies();
    if (currencies.size() != 1) {
      throw new IllegalStateException("Had more than one currency in result: " + pvss.getCurrencies());
    }
    final MulticurveSensitivity sensitivities = pvss.getSensitivity(Iterables.getOnlyElement(currencies));
    if (Double.doubleToLongBits(zSpread) == 0) {
      return sensitivities.getYieldDiscountingSensitivities();
    }
    final Map<String, List<DoublesPair>> result = new HashMap<>();
    for (final Map.Entry<String, List<DoublesPair>> entry : sensitivities.getYieldDiscountingSensitivities().entrySet()) {
View Full Code Here

   */
  public MultipleCurrencyParameterSensitivity calculateSensitivity(final InstrumentDerivative instrument, final DATA_TYPE parameterMulticurves, final Set<String> curvesSet) {
    ArgumentChecker.notNull(instrument, "derivative");
    ArgumentChecker.notNull(parameterMulticurves, "Black data");
    ArgumentChecker.notNull(curvesSet, "curves");
    final MultipleCurrencyMulticurveSensitivity sensitivity = instrument.accept(_curveSensitivityCalculator, parameterMulticurves);
    return pointToParameterSensitivity(sensitivity, parameterMulticurves, curvesSet);
  }
View Full Code Here

    final Map<String, List<DoublesPair>> mapDsc = new HashMap<>();
    final DoublesPair s = new DoublesPair(time, -time * cpn.getAmount() * multicurve.getDiscountFactor(cpn.getCurrency(), time));
    final List<DoublesPair> list = new ArrayList<>();
    list.add(s);
    mapDsc.put(multicurve.getName(cpn.getCurrency()), list);
    MultipleCurrencyMulticurveSensitivity result = new MultipleCurrencyMulticurveSensitivity();
    result = result.plus(cpn.getCurrency(), MulticurveSensitivity.ofYieldDiscounting(mapDsc));
    return result;
  }
View Full Code Here

    final Map<String, List<DoublesPair>> mapDsc = new HashMap<>();
    final DoublesPair s = new DoublesPair(time, -time * cpn.getAmount() * multicurve.getDiscountFactor(cpn.getCurrency(), time));
    final List<DoublesPair> list = new ArrayList<>();
    list.add(s);
    mapDsc.put(multicurve.getName(cpn.getCurrency()), list);
    MultipleCurrencyMulticurveSensitivity result = new MultipleCurrencyMulticurveSensitivity();
    result = result.plus(cpn.getCurrency(), MulticurveSensitivity.ofYieldDiscounting(mapDsc));
    return result;
  }
View Full Code Here

    final List<ForwardSensitivity> listForward = new ArrayList<>();
    for (int i = 0; i < coupon.getFixingPeriodAccrualFactors().length; i++) {
      listForward.add(new ForwardSensitivity(coupon.getFixingPeriodStartTimes()[i], coupon.getFixingPeriodEndTimes()[i], coupon.getFixingPeriodAccrualFactorsActAct()[i], forwardBar[i]));
    }
    mapFwd.put(multicurve.getName(coupon.getIndex()), listForward);
    final MultipleCurrencyMulticurveSensitivity result = MultipleCurrencyMulticurveSensitivity.of(coupon.getCurrency(), MulticurveSensitivity.of(mapDsc, mapFwd));
    return result;
  }
View Full Code Here

   * @param fx The Forex transaction.
   * @param multicurves The multi-curve provider.
   * @return The sensitivity.
   */
  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Forex fx, final MulticurveProviderInterface multicurves) {
    MultipleCurrencyMulticurveSensitivity pvcs1 = METHOD_PAY.presentValueCurveSensitivity(fx.getPaymentCurrency1(), multicurves);
    MultipleCurrencyMulticurveSensitivity pvcs2 = METHOD_PAY.presentValueCurveSensitivity(fx.getPaymentCurrency2(), multicurves);
    return pvcs1.plus(pvcs2);
  }
View Full Code Here

    //    double spread = pv2 / (notional1 * dfEnd);
    // Backward sweep
    final double spreadBar = 1.0;
    final double dfEndBar = -pv2 / (notional1 * dfEnd * dfEnd) * spreadBar;
    final double pv2Bar = spreadBar / (notional1 * dfEnd);
    final MultipleCurrencyMulticurveSensitivity pv2DrMC = presentValueCurveSensitivity(fx, multicurves);
    final MulticurveSensitivity pv2Dr = pv2DrMC.converted(ccy2, multicurves.getFxRates()).getSensitivity(ccy2);
    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(payTime, -payTime * dfEnd * dfEndBar));
    final Map<String, List<DoublesPair>> result = new HashMap<>();
    result.put(multicurves.getName(ccy2), list);
    final MulticurveSensitivity dfEndDr = MulticurveSensitivity.ofYieldDiscounting(result);
View Full Code Here

  @Test
  /**
   * Tests the method against the present value curve sensitivity calculator.
   */
  public void presentValueCurveSensitivityMethodVsCalculator() {
    final MultipleCurrencyMulticurveSensitivity pvcsMethod = METHOD_SWPT_SABR.presentValueCurveSensitivity(SWAPTION_LONG_PAYER, SABR_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsCalculator = PVCSSSC.visit(SWAPTION_LONG_PAYER, SABR_MULTICURVES);
    assertEquals("SwaptionPhysicalFixedIborSABRMethod: present value curve sensitivity: method and calculator", pvcsMethod, pvcsCalculator);
  }
View Full Code Here

   * @param multicurves The multi-curves provider.
   * @return The sensitivity.
   */
  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForexSwap fx, final MulticurveProviderInterface multicurves) {
    ArgumentChecker.notNull(fx, "Forex swap");
    MultipleCurrencyMulticurveSensitivity result = METHOD_FX.presentValueCurveSensitivity(fx.getNearLeg(), multicurves);
    result = result.plus(METHOD_FX.presentValueCurveSensitivity(fx.getFarLeg(), multicurves));
    return result;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity

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.