//------------------------------------------------------------------------- public virtual void test_presentValueSensitivity() { PointSensitivityBuilder point = PRICER.presentValueSensitivity(PRODUCT, PROVIDER); CurrencyParameterSensitivities computed = PROVIDER.parameterSensitivity(point.build()); CurrencyParameterSensitivities expected = FD_CAL.sensitivity(PROVIDER, p => PRICER.presentValue(PRODUCT, p)); assertTrue(computed.equalWithTolerance(expected, 30d * NOTIONAL * EPS)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the present value sensitivity of the fixed coupon bond trade. /// <para> /// The present value sensitivity of the trade is the sensitivity of the present value to /// the underlying curves. /// </para> /// <para> /// Coupon payments of the underlying product are considered based on the settlement date of the trade. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the discounting provider </param> /// <returns> the present value curve sensitivity of the trade </returns> public virtual PointSensitivities presentValueSensitivity(ResolvedFixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { LocalDate settlementDate = this.settlementDate(trade, provider.ValuationDate); PointSensitivityBuilder sensiProduct = productPricer.presentValueSensitivity(trade.Product, provider, settlementDate); return(presentValueSensitivityFromProductPresentValueSensitivity(trade, provider, sensiProduct).build()); }