Ejemplo n.º 1
0
        public virtual void test_presentValue()
        {
            MultiCurrencyAmount pvSensiTrade   = PRICER_TRADE.presentValue(OPTION_TRADE, RATES_PROVIDER, VOLS);
            CurrencyAmount      pvSensiProduct = PRICER_PRODUCT.presentValue(OPTION_PRODUCT, RATES_PROVIDER, VOLS);
            CurrencyAmount      pvSensiPremium = PRICER_PAYMENT.presentValue(PREMIUM, RATES_PROVIDER);

            assertEquals(pvSensiTrade, MultiCurrencyAmount.of(pvSensiProduct, pvSensiPremium));
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value of the FX barrier option trade.
        /// <para>
        /// The present value of the trade is the value on the valuation date.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the option trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="volatilities">  the Black volatility provider </param>
        /// <returns> the present value of the trade </returns>
        public virtual MultiCurrencyAmount presentValue(ResolvedFxSingleBarrierOptionTrade trade, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
        {
            ResolvedFxSingleBarrierOption product = trade.Product;
            CurrencyAmount pvProduct = productPricer.presentValue(product, ratesProvider, volatilities);
            Payment        premium   = trade.Premium;
            CurrencyAmount pvPremium = paymentPricer.presentValue(premium, ratesProvider);

            return(MultiCurrencyAmount.of(pvProduct, pvPremium));
        }