/// <summary> /// Validates that the swaption is single currency cash par-yield. /// </summary> /// <param name="swaption"> the swaption </param> protected internal virtual void validateSwaption(ResolvedSwaption swaption) { ArgChecker.isFalse(swaption.Underlying.CrossCurrency, "Underlying swap must be single currency"); ArgChecker.isTrue(swaption.SwaptionSettlement.SettlementType.Equals(SettlementType.CASH), "Swaption must be cash settlement"); CashSwaptionSettlement cashSettle = (CashSwaptionSettlement)swaption.SwaptionSettlement; ArgChecker.isTrue(cashSettle.Method.Equals(CashSwaptionSettlementMethod.PAR_YIELD), "Cash settlement method must be par yield"); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the numeraire, used to multiply the results. /// </summary> /// <param name="swaption"> the swap </param> /// <param name="fixedLeg"> the fixed leg </param> /// <param name="forward"> the forward rate </param> /// <param name="ratesProvider"> the rates provider </param> /// <returns> the numeraire </returns> protected internal virtual double calculateNumeraire(ResolvedSwaption swaption, ResolvedSwapLeg fixedLeg, double forward, RatesProvider ratesProvider) { double annuityCash = swapPricer.LegPricer.annuityCash(fixedLeg, forward); CashSwaptionSettlement cashSettlement = (CashSwaptionSettlement)swaption.SwaptionSettlement; double discountSettle = ratesProvider.discountFactor(fixedLeg.Currency, cashSettlement.SettlementDate); return(Math.Abs(annuityCash * discountSettle)); }