public virtual void parellelCs01Test() { double fromExcel = 4238.557409; CurrencyAmount fd = CS01_FD.parallelCs01(CDS1, ImmutableList.copyOf(MARKET_CDS), RATES_PROVIDER, REF_DATA); CurrencyAmount analytic = CS01_AN.parallelCs01(CDS1, ImmutableList.copyOf(MARKET_CDS), RATES_PROVIDER, REF_DATA); assertEquals(fd.Currency, USD); assertEquals(fd.Amount * ONE_BP, fromExcel, TOL * NOTIONAL); assertEquals(analytic.Currency, USD); assertEquals(analytic.Amount * ONE_BP, fd.Amount * ONE_BP, ONE_BP * NOTIONAL); // equivalence to market quote sensitivity for par spread quote PointSensitivities point = PRICER.presentValueOnSettleSensitivity(CDS1, RATES_PROVIDER, REF_DATA); CurrencyParameterSensitivity paramSensi = RATES_PROVIDER.singleCreditCurveParameterSensitivity(point, LEGAL_ENTITY, USD); CurrencyParameterSensitivities quoteSensi = QUOTE_CAL.sensitivity(CurrencyParameterSensitivities.of(paramSensi), RATES_PROVIDER); double cs01FromQuoteSensi = quoteSensi.Sensitivities.get(0).Sensitivity.sum(); assertEquals(cs01FromQuoteSensi * ONE_BP, analytic.Amount * ONE_BP, TOL * NOTIONAL); }
public virtual void test_presentValueOnSettleSensitivity() { PointSensitivities computed = PRICER.presentValueOnSettleSensitivity(TRADE, RATES_PROVIDER, REF_DATA); PointSensitivities expected = PRICER_PRODUCT.presentValueSensitivity(PRODUCT, RATES_PROVIDER, SETTLEMENT_DATE, REF_DATA).build(); PointSensitivities computedMf = PRICER_MF.presentValueOnSettleSensitivity(TRADE_NO_SETTLE_DATE, RATES_PROVIDER, REF_DATA); PointSensitivities expectedMf = PRICER_PRODUCT_MF.presentValueSensitivity(PRODUCT, RATES_PROVIDER, SETTLEMENT_DATE, REF_DATA).build(); assertTrue(computed.equalWithTolerance(expected, TOL)); assertTrue(computedMf.equalWithTolerance(expectedMf, TOL)); }