//------------------------------------------------------------------------- /// <summary> /// Calculates the present value delta of the Ibor cap/floor leg. /// <para> /// The present value delta of the leg is the sensitivity value on the valuation date. /// The result is returned using the payment currency of the leg. /// /// </para> /// </summary> /// <param name="capFloorLeg"> the Ibor cap/floor leg </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the present value delta </returns> public virtual CurrencyAmount presentValueDelta(ResolvedIborCapFloorLeg capFloorLeg, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { validate(ratesProvider, volatilities); return(capFloorLeg.CapletFloorletPeriods.Select(period => periodPricer.presentValueDelta(period, ratesProvider, volatilities)).Aggregate((c1, c2) => c1.plus(c2)).get()); }
/// <summary> /// Calculates the present value sensitivity to the SABR model parameters of the Ibor cap/floor. /// <para> /// The sensitivity of the present value to the SABR model parameters, alpha, beta, rho and nu. /// /// </para> /// </summary> /// <param name="capFloorLeg"> the Ibor cap/floor </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the point sensitivity to the SABR model parameters </returns> public virtual PointSensitivityBuilder presentValueSensitivityModelParamsSabr(ResolvedIborCapFloorLeg capFloorLeg, RatesProvider ratesProvider, SabrIborCapletFloorletVolatilities volatilities) { validate(ratesProvider, volatilities); return(capFloorLeg.CapletFloorletPeriods.Select(period => periodPricer.presentValueSensitivityModelParamsSabr(period, ratesProvider, volatilities)).Aggregate((c1, c2) => c1.combinedWith(c2)).get()); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the current cash of the Ibor cap/floor leg. /// </summary> /// <param name="capFloorLeg"> the Ibor cap/floor leg </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the current cash </returns> public virtual CurrencyAmount currentCash(ResolvedIborCapFloorLeg capFloorLeg, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { validate(ratesProvider, volatilities); return(capFloorLeg.CapletFloorletPeriods.Where(period => period.PaymentDate.Equals(ratesProvider.ValuationDate)).Select(period => periodPricer.presentValue(period, ratesProvider, volatilities)).Aggregate((c1, c2) => c1.plus(c2)).orElse(CurrencyAmount.zero(capFloorLeg.Currency))); }