Пример #1
0
        public virtual void test_convexityAdjustment()
        {
            double computed = PRICER.convexityAdjustment(FUTURE, RATE_PROVIDER, HW_PROVIDER);
            double priceHw  = PRICER.price(FUTURE, RATE_PROVIDER, HW_PROVIDER);
            double priceDsc = PRICER_DSC.price(FUTURE, RATE_PROVIDER);     // no convexity adjustment

            assertEquals(priceDsc + computed, priceHw, TOL);
        }
Пример #2
0
        //-------------------------------------------------------------------------
        public virtual void test_price()
        {
            IborIndexRates      mockIbor = mock(typeof(IborIndexRates));
            SimpleRatesProvider prov     = new SimpleRatesProvider();

            prov.IborRates = mockIbor;
            when(mockIbor.rate(FUTURE.IborRate.Observation)).thenReturn(RATE);

            assertEquals(PRICER.price(FUTURE, prov), 1.0 - RATE, TOLERANCE_PRICE);
        }
        //-------------------------------------------------------------------------
        // calculate the price of the underlying future
        private double futurePrice(ResolvedIborFutureOption futureOption, RatesProvider ratesProvider)
        {
            ResolvedIborFuture future = futureOption.UnderlyingFuture;

            return(futurePricer.price(future, ratesProvider));
        }
Пример #4
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the price of the Ibor future trade.
 /// <para>
 /// The price of the trade is the price on the valuation date.
 /// The price is calculated using the discounting model.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="ratesProvider">  the rates provider </param>
 /// <returns> the price of the trade, in decimal form </returns>
 public virtual double price(ResolvedIborFutureTrade trade, RatesProvider ratesProvider)
 {
     return(productPricer.price(trade.Product, ratesProvider));
 }