Example #1
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue_noFixing()
        {
            double         discountFactor = IMM_PROV_NOFIX.discountFactor(EUR, END_DATE);
            double         forwardRate    = IMM_PROV_NOFIX.iborIndexRates(EUR_EURIBOR_6M).rate(RDEPOSIT.FloatingRate.Observation);
            CurrencyAmount computed       = PRICER.presentValue(RDEPOSIT, IMM_PROV_NOFIX);
            double         expected       = NOTIONAL * discountFactor * (RATE - forwardRate) * RDEPOSIT.YearFraction;

            assertEquals(computed.Currency, EUR);
            assertEquals(computed.Amount, expected, TOLERANCE_PV);
        }
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            CurrencyAmount pvTrade   = PRICER_TRADE.presentValue(RDEPOSIT_TRADE, IMM_PROV);
            CurrencyAmount pvProduct = PRICER_PRODUCT.presentValue(RDEPOSIT_PRODUCT, IMM_PROV);

            assertEquals(pvTrade.Currency, pvProduct.Currency);
            assertEquals(pvTrade.Amount, pvProduct.Amount, TOLERANCE_PV);
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the present value of the Ibor fixing deposit trade.
 /// <para>
 /// The present value of the trade is the value on the valuation date.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="provider">  the rates provider </param>
 /// <returns> the present value of the product </returns>
 public virtual CurrencyAmount presentValue(ResolvedIborFixingDepositTrade trade, RatesProvider provider)
 {
     return(productPricer.presentValue(trade.Product, provider));
 }