/// <summary> /// Calculates the price for settlement at a given settlement date using curves with z-spread. /// <para> /// The z-spread is a parallel shift applied to continuously compounded rates or /// periodic compounded rates of the issuer discounting curve. /// </para> /// <para> /// The z-spread is applied only on the legal entity curve, not on the repo curve. /// /// </para> /// </summary> /// <param name="bill"> the bill </param> /// <param name="provider"> the discounting provider </param> /// <param name="settlementDate"> the settlement date </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 price </returns> public virtual double priceFromCurvesWithZSpread(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear) { ArgChecker.inOrderNotEqual(settlementDate, bill.Notional.Date, "settlementDate", "endDate"); ArgChecker.inOrderOrEqual(provider.ValuationDate, settlementDate, "valuationDate", "settlementDate"); IssuerCurveDiscountFactors issuerDf = issuerCurveDf(bill, provider); double dfMaturity = issuerDf.DiscountFactors.discountFactorWithSpread(bill.Notional.Date, zSpread, compoundedRateType, periodsPerYear); RepoCurveDiscountFactors repoDf = repoCurveDf(bill, provider); double dfRepoSettle = repoDf.discountFactor(settlementDate); return(dfMaturity / dfRepoSettle); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the price for settlement at a given settlement date using curves. /// </summary> /// <param name="bill"> the bill </param> /// <param name="provider"> the discounting provider </param> /// <param name="settlementDate"> the settlement date </param> /// <returns> the price </returns> public virtual double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) { ArgChecker.inOrderNotEqual(settlementDate, bill.Notional.Date, "settlementDate", "endDate"); ArgChecker.inOrderOrEqual(provider.ValuationDate, settlementDate, "valuationDate", "settlementDate"); IssuerCurveDiscountFactors issuerDf = issuerCurveDf(bill, provider); double dfMaturity = issuerDf.discountFactor(bill.Notional.Date); RepoCurveDiscountFactors repoDf = repoCurveDf(bill, provider); double dfRepoSettle = repoDf.discountFactor(settlementDate); return(dfMaturity / dfRepoSettle); }