public virtual void test_price() { double computed = TRADE_PRICER.price(FUTURE_TRADE, PROVIDER); double expected = PRODUCT_PRICER.price(FUTURE, PROVIDER); assertEquals(computed, expected, TOL); }
//------------------------------------------------------------------------- public virtual void test_price() { double computed = PRICER.price(FUTURE, PROVIDER); double pvSwap = PRICER.SwapPricer.presentValue(RSWAP, PROVIDER).getAmount(USD).Amount; double yc = ACT_ACT_ISDA.relativeYearFraction(VAL_DATE, DELIVERY); double df = Math.Exp(-USD_DSC.yValue(yc) * yc); double expected = 1d + pvSwap / df; assertEquals(computed, expected, TOL); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the price of the underlying deliverable swap futures product. /// <para> /// The price of the trade is the price on the valuation date. /// /// </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(ResolvedDsfTrade trade, RatesProvider ratesProvider) { return(productPricer.price(trade.Product, ratesProvider)); }