Ejemplo n.º 1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value of the swaption trade.
        /// <para>
        /// The result is expressed using the currency of the swaption.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the swaption trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="swaptionVolatilities">  the volatilities </param>
        /// <returns> the present value </returns>
        public virtual CurrencyAmount presentValue(ResolvedSwaptionTrade trade, RatesProvider ratesProvider, NormalSwaptionVolatilities swaptionVolatilities)
        {
            // product
            ResolvedSwaption product   = trade.Product;
            CurrencyAmount   pvProduct = isCash(product) ? cashParYieldPricer.presentValue(product, ratesProvider, swaptionVolatilities) : physicalPricer.presentValue(product, ratesProvider, swaptionVolatilities);
            // premium
            Payment        premium   = trade.Premium;
            CurrencyAmount pvPremium = paymentPricer.presentValue(premium, ratesProvider);

            // total
            return(pvProduct.plus(pvPremium));
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value sensitivity to the implied volatility of the swaption trade.
        /// <para>
        /// The sensitivity to the normal volatility is also called normal vega.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the swaption trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="swaptionVolatilities">  the volatilities </param>
        /// <returns> the point sensitivity to the normal volatility </returns>
        public virtual PointSensitivities presentValueSensitivityModelParamsVolatility(ResolvedSwaptionTrade trade, RatesProvider ratesProvider, NormalSwaptionVolatilities swaptionVolatilities)
        {
            ResolvedSwaption    product   = trade.Product;
            SwaptionSensitivity pointSens = isCash(product) ? cashParYieldPricer.presentValueSensitivityModelParamsVolatility(product, ratesProvider, swaptionVolatilities) : physicalPricer.presentValueSensitivityModelParamsVolatility(product, ratesProvider, swaptionVolatilities);

            return(PointSensitivities.of(pointSens));
        }
Ejemplo n.º 3
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Computes the currency exposure of the swaption trade.
 /// </summary>
 /// <param name="trade">  the swaption trade </param>
 /// <param name="ratesProvider">  the rates provider </param>
 /// <param name="swaptionVolatilities">  the volatilities </param>
 /// <returns> the currency exposure </returns>
 public virtual MultiCurrencyAmount currencyExposure(ResolvedSwaptionTrade trade, RatesProvider ratesProvider, NormalSwaptionVolatilities swaptionVolatilities)
 {
     return(MultiCurrencyAmount.of(presentValue(trade, ratesProvider, swaptionVolatilities)));
 }
Ejemplo n.º 4
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value sensitivity of the swaption trade to the rate curves.
        /// <para>
        /// The present value sensitivity is computed in a "sticky strike" style, i.e. the sensitivity to the
        /// curve nodes with the volatility at the swaption strike unchanged. This sensitivity does not include a potential
        /// change of volatility due to the implicit change of forward rate or moneyness.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the swaption trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="swaptionVolatilities">  the volatilities </param>
        /// <returns> the point sensitivity to the rate curves </returns>
        public virtual PointSensitivities presentValueSensitivityRatesStickyStrike(ResolvedSwaptionTrade trade, RatesProvider ratesProvider, NormalSwaptionVolatilities swaptionVolatilities)
        {
            // product
            ResolvedSwaption        product   = trade.Product;
            PointSensitivityBuilder pointSens = isCash(product) ? cashParYieldPricer.presentValueSensitivityRatesStickyStrike(product, ratesProvider, swaptionVolatilities) : physicalPricer.presentValueSensitivityRatesStickyStrike(product, ratesProvider, swaptionVolatilities);
            // premium
            Payment premium = trade.Premium;
            PointSensitivityBuilder pvcsPremium = paymentPricer.presentValueSensitivity(premium, ratesProvider);

            // total
            return(pointSens.combinedWith(pvcsPremium).build());
        }