@Test(enabled = true) /** * Tests to estimate the impact of mu on the CMS coupon pricing. "enabled = false" for the * standard testing. */ public void testPriceMultiMu() { final double[] mu = new double[] {1.10, 1.30, 1.55, 2.25, 3.50, 6.00, 15.0}; final int nbMu = mu.length; final double priceCouponStd = METHOD_STANDARD_CPN.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR); @SuppressWarnings("unused") final double rateCouponStd = priceCouponStd / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); final double[] priceCouponExtra = new double[nbMu]; final double[] rateCouponExtra = new double[nbMu]; for (int loopmu = 0; loopmu < nbMu; loopmu++) { final CouponCMSSABRExtrapolationRightReplicationMethod methodExtrapolation = new CouponCMSSABRExtrapolationRightReplicationMethod(CUT_OFF_STRIKE, mu[loopmu]); priceCouponExtra[loopmu] = methodExtrapolation.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR); rateCouponExtra[loopmu] = priceCouponExtra[loopmu] / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); } final double priceCouponNoAdj = METHOD_DSC_CPN.presentValue(CMS_COUPON, MULTICURVES).getAmount(EUR); final double rateCouponNoAdj = priceCouponNoAdj / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); for (int loopmu = 1; loopmu < nbMu; loopmu++) { assertTrue( "Extrapolation: comparison with standard method", rateCouponExtra[loopmu - 1] > rateCouponExtra[loopmu]); } assertTrue( "Extrapolation: comparison with standard method", rateCouponExtra[nbMu - 1] > rateCouponNoAdj); }
/** * Test the present value for a CMS coupon with pricing by replication in the SABR with * extrapolation framework. The present value is tested against hard-coded value and cap of strike * 0. */ public void presentValue() { // CMS cap/floor with strike 0 has the same price as a CMS coupon. final double priceCouponStd = METHOD_STANDARD_CPN.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR).getAmount(); final double rateCouponStd = priceCouponStd / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); final double priceCouponExtra = METHOD_EXTRAPOLATION_CPN .presentValue(CMS_COUPON, SABR_MULTICURVES) .getAmount(EUR) .getAmount(); final double rateCouponExtra = priceCouponExtra / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); final double priceCouponNoAdj = METHOD_DSC_CPN.presentValue(CMS_COUPON, MULTICURVES).getAmount(EUR).getAmount(); final double rateCouponNoAdj = priceCouponNoAdj / (CMS_COUPON.getPaymentYearFraction() * CMS_COUPON.getNotional() * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime())); assertEquals( "Extrapolation: comparison with standard method", rateCouponStd > rateCouponExtra, true); assertEquals( "Extrapolation: comparison with no convexity adjustment", rateCouponExtra > rateCouponNoAdj, true); final double rateCouponExtraExpected = 0.0189864; // From previous run. assertEquals("Extrapolation: hard-coded value", rateCouponExtraExpected, rateCouponExtra, 1E-6); final double priceCap0Extra = METHOD_EXTRAPOLATION_CAP .presentValue(CMS_CAP_0, SABR_MULTICURVES) .getAmount(EUR) .getAmount(); assertEquals( "Extrapolation: CMS coupon vs Cap 0", priceCouponExtra, priceCap0Extra, TOLERANCE_PV); }