CapFloorInflationZeroCouponInterpolationBlackSmileMethod { public MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CapFloorInflationZeroCouponInterpolation cap, final BlackSmileCapInflationZeroCouponProviderInterface black) { ArgumentChecker.notNull(cap, "The cap/floor shoud not be null"); ArgumentChecker.notNull(black, "Black provider"); final InflationProviderInterface inflation = black.getInflationProvider(); final double timeToMaturity = cap.getReferenceEndTime()[1] - cap.getLastKnownFixingTime(); final EuropeanVanillaOption option = new EuropeanVanillaOption(Math.pow(1 + cap.getStrike(), cap.getMaturity()), timeToMaturity, cap.isCap()); final double indexEndValue0 = black.getInflationProvider().getPriceIndex(cap.getPriceIndex(), cap.getReferenceEndTime()[0]); final double indexEndValue1 = black.getInflationProvider().getPriceIndex(cap.getPriceIndex(), cap.getReferenceEndTime()[1]); final double indexEndValue = cap.getWeight() * indexEndValue0 + (1 - cap.getWeight()) * indexEndValue1; final double forward = indexEndValue / cap.getIndexStartValue(); 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(DoublesPair.of(cap.getReferenceEndTime()[0], cap.getWeight() / cap.getIndexStartValue())); listPrice.add(DoublesPair.of(cap.getReferenceEndTime()[1], (1 - cap.getWeight()) / 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()[1], 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(DoublesPair.of(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); } private  CapFloorInflationZeroCouponInterpolationBlackSmileMethod(); static CapFloorInflationZeroCouponInterpolationBlackSmileMethod getInstance(); MultipleCurrencyAmount netAmount(final CapFloorInflationZeroCouponInterpolation cap, final BlackSmileCapInflationZeroCouponProviderInterface black); MultipleCurrencyAmount presentValue(final CapFloorInflationZeroCouponInterpolation cap, final BlackSmileCapInflationZeroCouponProviderInterface black); MultipleCurrencyAmount presentValue(final InstrumentDerivative instrument, final BlackSmileCapInflationZeroCouponProviderInterface black); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CapFloorInflationZeroCouponInterpolation cap, final BlackSmileCapInflationZeroCouponProviderInterface black);  }
@Test public void presentValueCurveSensitivity() { final MultipleCurrencyParameterSensitivity pvicsFD = PS_PV_FDC.calculateSensitivity(ZERO_COUPON_CAP, BLACK_INFLATION); final MultipleCurrencyParameterSensitivity pvicsExact = PSC.calculateSensitivity(ZERO_COUPON_CAP, BLACK_INFLATION); AssertSensitivityObjects.assertEquals("Zero-coupon inflation DiscountingMethod: presentValueCurveSensitivity ", pvicsExact, pvicsFD, TOLERANCE_PV_DELTA); }
@Test public void presentValueMarketSensitivityMethodVsCalculator() { final MultipleCurrencyInflationSensitivity pvcisMethod = METHOD.presentValueCurveSensitivity(ZERO_COUPON_CAP, BLACK_INFLATION); final MultipleCurrencyInflationSensitivity pvcisCalculator = ZERO_COUPON_CAP.accept(PVCSDC, BLACK_INFLATION); AssertSensitivityObjects.assertEquals("Zero-coupon inflation DiscountingMethod: presentValueMarketSensitivity", pvcisMethod, pvcisCalculator, TOLERANCE_PV_DELTA); }