//------------------------------------------------------------------------- /// <summary> /// Compute the present value curve sensitivity of the payment. /// <para> /// The present value sensitivity of the payment is the sensitivity of the /// present value to the discount factor curve. /// There is no sensitivity if the payment date is before the valuation date. /// /// </para> /// </summary> /// <param name="payment"> the payment </param> /// <param name="provider"> the provider </param> /// <returns> the point sensitivity of the present value </returns> public virtual PointSensitivityBuilder presentValueSensitivity(Payment payment, BaseProvider provider) { // duplicated code to avoid looking up in the provider when not necessary if (provider.ValuationDate.isAfter(payment.Date)) { return(PointSensitivityBuilder.none()); } DiscountFactors discountFactors = provider.discountFactors(payment.Currency); return(discountFactors.zeroRatePointSensitivity(payment.Date).multipliedBy(payment.Amount)); }