//-------------------------------------------------------------------------
        public virtual void test_presentValueSensitivityRates()
        {
            ImpliedTrinomialTreeFxSingleBarrierOptionProductPricer pricer = new ImpliedTrinomialTreeFxSingleBarrierOptionProductPricer(21);
            CurrencyParameterSensitivities             computed           = pricer.presentValueSensitivityRates(CALL_UKI_C, RATE_PROVIDER, VOLS);
            RatesFiniteDifferenceSensitivityCalculator calc     = new RatesFiniteDifferenceSensitivityCalculator(1.0e-5);
            CurrencyParameterSensitivities             expected = calc.sensitivity(RATE_PROVIDER, p => pricer.presentValue(CALL_UKI_C, p, VOLS));

            assertTrue(computed.equalWithTolerance(expected, 1.0e-13));
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// Calculates the present value sensitivity of the FX barrier option trade.
        /// <para>
        /// The present value sensitivity of the trade is the sensitivity of the present value to
        /// the underlying curves.
        /// </para>
        /// <para>
        /// The sensitivity is computed by bump and re-price, returning <seealso cref="CurrencyParameterSensitivities"/>,
        /// not <seealso cref="PointSensitivities"/>.
        /// </para>
        /// <para>
        /// The trinomial tree is first calibrated to Black volatilities,
        /// then the price is computed based on the calibrated tree.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the option trade </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="volatilities">  the Black volatility provider </param>
        /// <returns> the present value curve sensitivity of the trade </returns>
        public virtual CurrencyParameterSensitivities presentValueSensitivityRates(ResolvedFxSingleBarrierOptionTrade trade, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
        {
            ResolvedFxSingleBarrierOption  product     = trade.Product;
            CurrencyParameterSensitivities sensProduct = productPricer.presentValueSensitivityRates(product, ratesProvider, volatilities);
            Payment premium = trade.Premium;
            PointSensitivityBuilder        pvcsPremium = paymentPricer.presentValueSensitivity(premium, ratesProvider);
            CurrencyParameterSensitivities sensPremium = ratesProvider.parameterSensitivity(pvcsPremium.build());

            return(sensProduct.combinedWith(sensPremium));
        }
 public virtual void test_dataMismatch()
 {
     assertThrowsIllegalArg(() => PRICER_70.presentValueSensitivityRates(CALL_DKO, RATE_PROVIDER, VOLS, DATA_39));
 }