public virtual void test_dirtyPriceSensitivityWithZspread_continuous()
        {
            PointSensitivityBuilder        point    = PRICER.dirtyPriceSensitivityWithZspread(PRODUCT, PROVIDER, REF_DATA, Z_SPREAD, CONTINUOUS, 0);
            CurrencyParameterSensitivities computed = PROVIDER.parameterSensitivity(point.build());
            CurrencyParameterSensitivities expected = FD_CAL.sensitivity(PROVIDER, p => CurrencyAmount.of(EUR, PRICER.dirtyPriceFromCurvesWithZSpread(PRODUCT, p, REF_DATA, Z_SPREAD, CONTINUOUS, 0)));

            assertTrue(computed.equalWithTolerance(expected, NOTIONAL * EPS));
        }
        /// <summary>
        /// Calculates the price sensitivity of the bond future product with z-spread.
        /// <para>
        /// The price sensitivity of the product is the sensitivity of the price to the underlying curves.
        /// </para>
        /// <para>
        /// The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates
        /// of the issuer discounting curve.
        /// </para>
        /// <para>
        /// Note that the price sensitivity should be no currency.
        ///
        /// </para>
        /// </summary>
        /// <param name="future">  the future </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 curve sensitivity of the product </returns>
        public PointSensitivities priceSensitivityWithZSpread(ResolvedBondFuture future, LegalEntityDiscountingProvider discountingProvider, double zSpread, CompoundedRateType compoundedRateType, int periodPerYear)
        {
            ImmutableList <ResolvedFixedCouponBond> basket = future.DeliveryBasket;
            int size = basket.size();

            double[] priceBonds = new double[size];
            int      indexCTD   = 0;
            double   priceMin   = 2d;

            for (int i = 0; i < size; i++)
            {
                ResolvedFixedCouponBond bond = basket.get(i);
                double dirtyPrice            = bondPricer.dirtyPriceFromCurvesWithZSpread(bond, discountingProvider, zSpread, compoundedRateType, periodPerYear, future.LastDeliveryDate);
                priceBonds[i] = bondPricer.cleanPriceFromDirtyPrice(bond, future.LastDeliveryDate, dirtyPrice) / future.ConversionFactors.get(i);
                if (priceBonds[i] < priceMin)
                {
                    priceMin = priceBonds[i];
                    indexCTD = i;
                }
            }
            ResolvedFixedCouponBond bond       = basket.get(indexCTD);
            PointSensitivityBuilder pointSensi = bondPricer.dirtyPriceSensitivityWithZspread(bond, discountingProvider, zSpread, compoundedRateType, periodPerYear, future.LastDeliveryDate);

            return(pointSensi.multipliedBy(1d / future.ConversionFactors.get(indexCTD)).build());
        }