private System.Func <ResolvedCdsTrade, DoubleArray> getParSpreadSensitivityFunction(CreditRatesProvider ratesProvider, CurveName curveName, Currency currency, ReferenceData refData) { System.Func <ResolvedCdsTrade, DoubleArray> func = (ResolvedCdsTrade trade) => { PointSensitivities point = tradePricer.parSpreadSensitivity(trade, ratesProvider, refData); return(ratesProvider.parameterSensitivity(point).getSensitivity(curveName, currency).Sensitivity); }; return(func); }
public virtual void test_parSpreadSensitivity() { PointSensitivities computed = PRICER.parSpreadSensitivity(TRADE, RATES_PROVIDER, REF_DATA); PointSensitivities expected = PRICER_PRODUCT.parSpreadSensitivity(PRODUCT, RATES_PROVIDER, SETTLEMENT_DATE, REF_DATA).build(); PointSensitivities computedMf = PRICER_MF.parSpreadSensitivity(TRADE_NO_SETTLE_DATE, RATES_PROVIDER, REF_DATA); PointSensitivities expectedMf = PRICER_PRODUCT_MF.parSpreadSensitivity(PRODUCT, RATES_PROVIDER, SETTLEMENT_DATE, REF_DATA).build(); assertTrue(computed.equalWithTolerance(expected, TOL)); assertTrue(computedMf.equalWithTolerance(expectedMf, TOL)); }