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