/// <summary> /// Calculates the present value sensitivity of the bill product with z-spread. /// <para> /// The present value sensitivity of the product is the sensitivity of the present value to /// the underlying curves. /// </para> /// <para> /// The z-spread is a parallel shift applied to continuously compounded rates or /// periodic compounded rates of the issuer discounting curve. /// /// </para> /// </summary> /// <param name="bill"> the product </param> /// <param name="provider"> the discounting provider </param> /// <param name="zSpread"> the z-spread </param> /// <param name="compoundedRateType"> the compounded rate type </param> /// <param name="periodsPerYear"> the number of periods per year </param> /// <returns> the present value curve sensitivity of the product </returns> public virtual PointSensitivities presentValueSensitivityWithZSpread(ResolvedBill bill, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear) { if (provider.ValuationDate.isAfter(bill.Notional.Date)) { return(PointSensitivities.empty()); } IssuerCurveDiscountFactors issuerDf = issuerCurveDf(bill, provider); double dfEndBar = bill.Notional.Amount; ZeroRateSensitivity zeroSensMaturity = issuerDf.DiscountFactors.zeroRatePointSensitivityWithSpread(bill.Notional.Date, zSpread, compoundedRateType, periodsPerYear); IssuerCurveZeroRateSensitivity dscSensMaturity = IssuerCurveZeroRateSensitivity.of(zeroSensMaturity, issuerDf.LegalEntityGroup).multipliedBy(dfEndBar); return(dscSensMaturity.build()); }