示例#1
0
        //-------------------------------------------------------------------------
        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);
        }
示例#2
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue_notStarted()
        {
            SimpleRatesProvider prov     = provider(VAL_DATE, DF_START, DF_END);
            CurrencyAmount      computed = PRICER.presentValue(RTERM_DEPOSIT, prov);
            double expected = ((1d + RATE * RTERM_DEPOSIT.YearFraction) * DF_END - DF_START) * NOTIONAL;

            assertEquals(computed.Currency, EUR);
            assertEquals(computed.Amount, expected, TOLERANCE * NOTIONAL);
        }
示例#3
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the present value by discounting the final cash flow (nominal + interest)
 /// and the initial payment (initial amount).
 /// <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(ResolvedTermDepositTrade trade, RatesProvider provider)
 {
     return(productPricer.presentValue(trade.Product, provider));
 }