// computes sensitivity with finite difference approximation private CurrencyParameterSensitivities fdSensitivityWithZSpread(CapitalIndexedBondPaymentPeriod period, ImmutableRatesProvider ratesProvider, LegalEntityDiscountingProvider issuerRatesProvider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear) { CurrencyParameterSensitivities sensi1 = FD_CAL.sensitivity(issuerRatesProvider, p => CurrencyAmount.of(USD, PRICER.presentValueWithZSpread(period, ratesProvider, p.issuerCurveDiscountFactors(CapitalIndexedBondCurveDataSet.IssuerId, USD), zSpread, compoundedRateType, periodsPerYear))); CurrencyParameterSensitivities sensi2 = FD_CAL.sensitivity(ratesProvider, p => CurrencyAmount.of(USD, PRICER.presentValueWithZSpread(period, p, issuerRatesProvider.issuerCurveDiscountFactors(CapitalIndexedBondCurveDataSet.IssuerId, USD), zSpread, compoundedRateType, periodsPerYear))); return(sensi1.combinedWith(sensi2)); }
// extracts the issuer curve discount factors for the bond internal static IssuerCurveDiscountFactors issuerCurveDf(ResolvedBill bill, LegalEntityDiscountingProvider provider) { return(provider.issuerCurveDiscountFactors(bill.LegalEntityId, bill.Currency)); }