コード例 #1
0
        public virtual void test_priceWithZSpread_continuous()
        {
            double computed   = FUTURE_PRICER.priceWithZSpread(FUTURE_PRODUCT, PROVIDER, Z_SPREAD, CONTINUOUS, 0);
            double dirtyPrice = BOND_PRICER.dirtyPriceFromCurvesWithZSpread(BOND, PROVIDER, Z_SPREAD, CONTINUOUS, 0, FUTURE_PRODUCT.LastDeliveryDate);
            double expected   = BOND_PRICER.cleanPriceFromDirtyPrice(BOND, FUTURE_PRODUCT.LastDeliveryDate, dirtyPrice) / CONVERSION_FACTOR[0];

            assertEquals(computed, expected, TOL);
        }
        public virtual void test_priceWithZSpread_continuous()
        {
            double computed = TRADE_PRICER.priceWithZSpread(FUTURE_TRADE, PROVIDER, Z_SPREAD, CONTINUOUS, 0);
            double expected = PRODUCT_PRICER.priceWithZSpread(FUTURE_PRODUCT, PROVIDER, Z_SPREAD, CONTINUOUS, 0);

            assertEquals(computed, expected, TOL);
        }
 /// <summary>
 /// Calculates the price of the bond future trade with z-spread.
 /// <para>
 /// The price of the trade is the price on the valuation date.
 /// </para>
 /// <para>
 /// The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates
 /// of the issuer discounting curve.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="discountingProvider">  the discounting provider </param>
 /// <param name="zSpread">  the z-spread </param>
 /// <param name="compoundedRateType">  the compounded rate type </param>
 /// <param name="periodPerYear">  the number of periods per year </param>
 /// <returns> the price of the trade, in decimal form </returns>
 public double priceWithZSpread(ResolvedBondFutureTrade trade, LegalEntityDiscountingProvider discountingProvider, double zSpread, CompoundedRateType compoundedRateType, int periodPerYear)
 {
     return(productPricer.priceWithZSpread(trade.Product, discountingProvider, zSpread, compoundedRateType, periodPerYear));
 }