예제 #1
0
        //-------------------------------------------------------------------------
        public virtual void present_value_sensitivity_premium_forward()
        {
            PointSensitivities             pvcsTrade   = PRICER_TRADE.presentValueSensitivityRatesStickyStrike(SWAPTION_PREFWD_LONG_REC, RATE_PROVIDER, VOLS);
            PointSensitivityBuilder        pvcsProduct = PRICER_PRODUCT.presentValueSensitivityRatesStickyStrike(SWAPTION_LONG_REC, RATE_PROVIDER, VOLS);
            PointSensitivityBuilder        pvcsPremium = PRICER_PAYMENT.presentValueSensitivity(PREMIUM_FWD_PAY, RATE_PROVIDER);
            CurrencyParameterSensitivities pvpsTrade   = RATE_PROVIDER.parameterSensitivity(pvcsTrade);
            CurrencyParameterSensitivities pvpsProduct = RATE_PROVIDER.parameterSensitivity(pvcsProduct.combinedWith(pvcsPremium).build());

            assertTrue(pvpsTrade.equalWithTolerance(pvpsProduct, NOTIONAL * TOL));
        }
        //-------------------------------------------------------------------------
        /// <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, BlackSwaptionVolatilities 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());
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_currencyExposure()
        {
            MultiCurrencyAmount     computedRec = PRICER.currencyExposure(SWAPTION_REC_LONG, RATE_PROVIDER, VOLS);
            MultiCurrencyAmount     computedPay = PRICER.currencyExposure(SWAPTION_PAY_SHORT, RATE_PROVIDER, VOLS);
            PointSensitivityBuilder pointRec    = PRICER.presentValueSensitivityRatesStickyStrike(SWAPTION_REC_LONG, RATE_PROVIDER, VOLS);
            MultiCurrencyAmount     expectedRec = RATE_PROVIDER.currencyExposure(pointRec.build()).plus(PRICER.presentValue(SWAPTION_REC_LONG, RATE_PROVIDER, VOLS));

            assertEquals(computedRec.size(), 1);
            assertEquals(computedRec.getAmount(EUR).Amount, expectedRec.getAmount(EUR).Amount, NOTIONAL * TOL);
            PointSensitivityBuilder pointPay    = PRICER.presentValueSensitivityRatesStickyStrike(SWAPTION_PAY_SHORT, RATE_PROVIDER, VOLS);
            MultiCurrencyAmount     expectedPay = RATE_PROVIDER.currencyExposure(pointPay.build()).plus(PRICER.presentValue(SWAPTION_PAY_SHORT, RATE_PROVIDER, VOLS));

            assertEquals(computedPay.size(), 1);
            assertEquals(computedPay.getAmount(EUR).Amount, expectedPay.getAmount(EUR).Amount, NOTIONAL * TOL);
        }