Ejemplo n.º 1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value theta of the Ibor caplet/floorlet period.
        /// <para>
        /// The present value theta is given by the minus of the present value sensitivity to the {@code timeToExpiry}
        /// parameter of the model.
        ///
        /// </para>
        /// </summary>
        /// <param name="period">  the Ibor caplet/floorlet period </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="volatilities">  the volatilities </param>
        /// <returns> the present value theta </returns>
        public virtual CurrencyAmount presentValueTheta(IborCapletFloorletPeriod period, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities)
        {
            validate(volatilities);
            double   expiry   = volatilities.relativeTime(period.FixingDateTime);
            Currency currency = period.Currency;

            if (expiry < 0d)
            {     // Option has expired already
                return(CurrencyAmount.of(currency, 0d));
            }
            double  forward    = ratesProvider.iborIndexRates(period.Index).rate(period.IborRate.Observation);
            double  strike     = period.Strike;
            double  volatility = volatilities.volatility(expiry, strike, forward);
            PutCall putCall    = period.PutCall;
            double  df         = ratesProvider.discountFactor(currency, period.PaymentDate);
            double  priceTheta = df * period.YearFraction * volatilities.priceTheta(expiry, putCall, strike, forward, volatility);

            return(CurrencyAmount.of(currency, priceTheta * period.Notional));
        }