Examples of InflationSensitivity


Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    final double df = black.getMulticurveProvider().getDiscountFactor(cap.getCurrency(), cap.getPaymentTime());
    final Map<String, List<DoublesPair>> resultMapPrice = new HashMap<>();
    final List<DoublesPair> listPrice = new ArrayList<>();
    listPrice.add(new DoublesPair(cap.getReferenceEndTime(), 1 / cap.getIndexStartValue()));
    resultMapPrice.put(inflation.getName(cap.getPriceIndex()), listPrice);
    final InflationSensitivity forwardDi = InflationSensitivity.ofPriceIndex(resultMapPrice);
    final double dfDr = -cap.getPaymentTime() * df;
    final double volatility = black.getBlackParameters().getVolatility(cap.getReferenceEndTime(), cap.getStrike());
    final BlackFunctionData dataBlack = new BlackFunctionData(forward, 1.0, volatility);
    final double[] bsAdjoint = BLACK_FUNCTION.getPriceAdjoint(option, dataBlack);
    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cap.getPaymentTime(), dfDr));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(inflation.getName(cap.getCurrency()), list);
    InflationSensitivity result = InflationSensitivity.ofYieldDiscounting(resultMap);
    result = result.multipliedBy(bsAdjoint[0]);
    result = result.plus(forwardDi.multipliedBy(df * bsAdjoint[1]));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyInflationSensitivity.of(cap.getCurrency(), result);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    listPrice.add(new DoublesPair(cap.getReferenceEndTime()[0], cap.getWeightEnd() / priceIndexStart * convexityAdjustment));
    listPrice.add(new DoublesPair(cap.getReferenceEndTime()[1], (1 - cap.getWeightEnd()) / priceIndexStart * convexityAdjustment));
    listPrice.add(new DoublesPair(cap.getReferenceStartTime()[0], -cap.getWeightStart() * priceIndexEnd / (priceIndexStart * priceIndexStart) * convexityAdjustment));
    listPrice.add(new DoublesPair(cap.getReferenceStartTime()[1], -(1 - cap.getWeightStart()) * priceIndexEnd / (priceIndexStart * priceIndexStart) * convexityAdjustment));
    resultMapPrice.put(inflation.getName(cap.getPriceIndex()), listPrice);
    final InflationSensitivity forwardDi = InflationSensitivity.ofPriceIndex(resultMapPrice);
    final double dfDr = -cap.getPaymentTime() * df;
    final double volatility = black.getBlackParameters().getVolatility(cap.getReferenceEndTime()[1], cap.getStrike());
    final NormalFunctionData dataBlack = new NormalFunctionData(forward, 1.0, volatility);
    final double[] priceDerivatives = new double[3];
    final double bsAdjoint = NORMAL_FUNCTION.getPriceAdjoint(option, dataBlack, priceDerivatives);
    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cap.getPaymentTime(), dfDr));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(inflation.getName(cap.getCurrency()), list);
    InflationSensitivity result = InflationSensitivity.ofYieldDiscounting(resultMap);
    result = result.multipliedBy(bsAdjoint);
    result = result.plus(forwardDi.multipliedBy(df * priceDerivatives[0]));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyInflationSensitivity.of(cap.getCurrency(), result);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    final Map<String, List<DoublesPair>> resultMapPrice = new HashMap<>();
    final List<DoublesPair> listPrice = new ArrayList<>();
    listPrice.add(new DoublesPair(cap.getReferenceEndTime(), 1 / priceIndexStart * convexityAdjustment));
    listPrice.add(new DoublesPair(cap.getReferenceStartTime(), -priceIndexEnd / (priceIndexStart * priceIndexStart) * convexityAdjustment));
    resultMapPrice.put(inflation.getName(cap.getPriceIndex()), listPrice);
    final InflationSensitivity forwardDi = InflationSensitivity.ofPriceIndex(resultMapPrice);
    final double dfDr = -cap.getPaymentTime() * df;
    final double volatility = black.getBlackParameters().getVolatility(cap.getReferenceEndTime(), cap.getStrike());
    final NormalFunctionData dataBlack = new NormalFunctionData(forward, 1.0, volatility);
    final double[] priceDerivatives = new double[3];
    final double bsAdjoint = NORMAL_FUNCTION.getPriceAdjoint(option, dataBlack, priceDerivatives);
    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cap.getPaymentTime(), dfDr));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(inflation.getName(cap.getCurrency()), list);
    InflationSensitivity result = InflationSensitivity.ofYieldDiscounting(resultMap);
    result = result.multipliedBy(bsAdjoint);
    result = result.plus(forwardDi.multipliedBy(df * priceDerivatives[0]));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyInflationSensitivity.of(cap.getCurrency(), result);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    final Map<String, List<DoublesPair>> resultMapPrice = new HashMap<>();
    final List<DoublesPair> listPrice = new ArrayList<>();
    listPrice.add(new DoublesPair(coupon.getReferenceEndTime(), estimatedIndexEndBar));
    listPrice.add(new DoublesPair(coupon.getReferenceStartTime(), estimatedIndexStartBar));
    resultMapPrice.put(inflation.getInflationProvider().getName(coupon.getPriceIndex()), listPrice);
    final InflationSensitivity inflationSensitivity = InflationSensitivity.ofYieldDiscountingAndPriceIndex(resultMapDisc, resultMapPrice);
    return MultipleCurrencyInflationSensitivity.of(coupon.getCurrency(), inflationSensitivity);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    listPrice.add(new DoublesPair(coupon.getReferenceEndTime()[0], estimatedIndexEndMonth0bar));
    listPrice.add(new DoublesPair(coupon.getReferenceEndTime()[1], estimatedIndexEndMonth1bar));
    listPrice.add(new DoublesPair(coupon.getReferenceStartTime()[0], estimatedIndexStartMonth0bar));
    listPrice.add(new DoublesPair(coupon.getReferenceStartTime()[1], estimatedIndexStartMonth1bar));
    resultMapPrice.put(inflation.getName(coupon.getPriceIndex()), listPrice);
    final InflationSensitivity inflationSensitivity = InflationSensitivity.ofYieldDiscountingAndPriceIndex(resultMapDisc, resultMapPrice);
    return MultipleCurrencyInflationSensitivity.of(coupon.getCurrency(), inflationSensitivity);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

        throw new OpenGammaRuntimeException("Should have same number of sensitivities as currencies");
      }
      MultipleCurrencyInflationSensitivity result = new MultipleCurrencyInflationSensitivity();
      for (int i = 0; i < currencies.size(); i++) {
        final Currency currency = Currency.of((String) currencies.get(i).getValue());
        final InflationSensitivity sensitivity = deserializer.fieldValueToObject(InflationSensitivity.class, sensitivities.get(i));
        result = result.plus(currency, sensitivity);
      }
      return result;
    }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

  private static final double TOLERANCE = 1.0E-10;

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullCcy() {
    MultipleCurrencyInflationSensitivity.of(null, new InflationSensitivity());
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    final String name3 = "PC1";
    final String name4 = "PC2";
    final Map<String, List<DoublesPair>> priceCurveSensitivities = new HashMap<>();
    priceCurveSensitivities.put(name3, Arrays.asList(new DoublesPair(1.2, 2.3), new DoublesPair(3.4, 4.5)));
    priceCurveSensitivities.put(name4, Arrays.asList(new DoublesPair(9.8, 8.7), new DoublesPair(5.4, 3.2), new DoublesPair(2.33, 3.44)));
    final InflationSensitivity is = InflationSensitivity.of(sensitivities, priceCurveSensitivities);
    assertEquals(is, cycleObject(InflationSensitivity.class, is));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    MultipleCurrencyInflationSensitivity.of(Currency.AUD, null);
  }

  @Test
  public void of() {
    final InflationSensitivity cs = InflationSensitivity.of(SENSI_11, SENSI_FWD_11, SENSI_33);
    final Currency ccy1 = Currency.AUD;
    final MultipleCurrencyInflationSensitivity mcs = MultipleCurrencyInflationSensitivity.of(ccy1, cs);
    assertEquals("MultipleCurrencyCurveSensitivityMarket: of", cs, mcs.getSensitivity(ccy1));
    MultipleCurrencyInflationSensitivity constructor = new MultipleCurrencyInflationSensitivity();
    constructor = constructor.plus(ccy1, cs);
    AssertSensivityObjects.assertEquals("MultipleCurrencyCurveSensitivityMarket: of", mcs.cleaned(), constructor.cleaned(), TOLERANCE);
    AssertSensivityObjects.assertEquals("MultipleCurrencyCurveSensitivityMarket: getSensitivity", new InflationSensitivity(), mcs.getSensitivity(Currency.CAD), TOLERANCE);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.provider.sensitivity.inflation.InflationSensitivity

    forwardCurveSensitivities1.put(name2, Arrays.asList(new ForwardSensitivity(0.1, 4, 0.5, 10)));
    final MulticurveSensitivity sensitivities1 = MulticurveSensitivity.of(yieldCurveSensitivities1, forwardCurveSensitivities1);
    final Map<String, List<DoublesPair>> priceCurveSensitivities1 = new HashMap<>();
    priceCurveSensitivities1.put("PC1", Arrays.asList(new DoublesPair(1.2, 2.3), new DoublesPair(3.4, 4.5)));
    priceCurveSensitivities1.put("PC2", Arrays.asList(new DoublesPair(9.8, 8.7), new DoublesPair(5.4, 3.2), new DoublesPair(2.33, 3.44)));
    final InflationSensitivity is1 = InflationSensitivity.of(sensitivities1, priceCurveSensitivities1);
    final String name3 = "YC3";
    final String name4 = "YC4";
    final Map<String, List<DoublesPair>> yieldCurveSensitivities2 = new HashMap<>();
    yieldCurveSensitivities2.put(name3, Arrays.asList(new DoublesPair(10., 20.)));
    yieldCurveSensitivities2.put(name4, Arrays.asList(new DoublesPair(110., 120.), new DoublesPair(13.51, 16.81), new DoublesPair(45.3, 12.3)));
    final Map<String, List<ForwardSensitivity>> forwardCurveSensitivities2 = new HashMap<>();
    forwardCurveSensitivities2.put(name3, Arrays.asList(new ForwardSensitivity(18, 58, 0.258, 108), new ForwardSensitivity(32, 92, 0.2252, 302)));
    forwardCurveSensitivities2.put(name4, Arrays.asList(new ForwardSensitivity(0.18, 48, 0.58, 18)));
    final MulticurveSensitivity sensitivities2 = MulticurveSensitivity.of(yieldCurveSensitivities2, forwardCurveSensitivities2);
    final Map<String, List<DoublesPair>> priceCurveSensitivities2 = new HashMap<>();
    priceCurveSensitivities1.put("PC3", Arrays.asList(new DoublesPair(1.21, 2.31), new DoublesPair(3.41, 4.51)));
    priceCurveSensitivities1.put("PC4", Arrays.asList(new DoublesPair(9.81, 8.71), new DoublesPair(5.41, 3.21), new DoublesPair(2.331, 3.441)));
    final InflationSensitivity is2 = InflationSensitivity.of(sensitivities2, priceCurveSensitivities2);
    MultipleCurrencyInflationSensitivity sensitivities = new MultipleCurrencyInflationSensitivity();
    sensitivities = sensitivities.plus(Currency.AUD, is1);
    sensitivities = sensitivities.plus(Currency.CAD, is2);
    assertEquals(sensitivities, cycleObject(MultipleCurrencyInflationSensitivity.class, sensitivities));
  }
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.