Example #1
0
        //-------------------------------------------------------------------------
        public virtual void present_value_premium_forward()
        {
            CurrencyAmount pvTrade   = PRICER_TRADE.presentValue(SWAPTION_PREFWD_LONG_REC, MULTI_USD, NORMAL_VOLS_USD);
            CurrencyAmount pvProduct = PRICER_PRODUCT.presentValue(SWAPTION_LONG_REC, MULTI_USD, NORMAL_VOLS_USD);
            CurrencyAmount pvPremium = PRICER_PAYMENT.presentValue(PREMIUM_FWD_PAY, MULTI_USD);

            assertEquals(pvTrade.Amount, pvProduct.Amount + pvPremium.Amount, TOLERANCE_PV);
            // test via VolatilitySwaptionTradePricer
            CurrencyAmount pv = PRICER_COMMON.presentValue(SWAPTION_PREFWD_LONG_REC, MULTI_USD, NORMAL_VOLS_USD);

            assertEquals(pv, pvTrade);
        }
Example #2
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));
        }
 //-------------------------------------------------------------------------
 public virtual void validate_physical_settlement()
 {
     assertThrowsIllegalArg(() => PRICER_SWAPTION_NORMAL.presentValue(SWAPTION_LONG_REC_CASH, MULTI_USD, NORMAL_VOLS_USD_STD));
 }