/// <summary>
        /// Calculates the par rate of the Ibor future product.
        /// <para>
        /// The par rate is given by ({@code 1 - price}).
        /// The par rate of the product is the value on the valuation date.
        ///
        /// </para>
        /// </summary>
        /// <param name="future">  the future </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="hwProvider">  the Hull-White model parameter provider </param>
        /// <returns> the par rate of the product, in decimal form </returns>
        public virtual double parRate(ResolvedIborFuture future, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider)
        {
            IborIndexObservation obs     = future.IborRate.Observation;
            double    forward            = ratesProvider.iborIndexRates(future.Index).rate(obs);
            LocalDate fixingStartDate    = obs.EffectiveDate;
            LocalDate fixingEndDate      = obs.MaturityDate;
            double    fixingYearFraction = obs.YearFraction;
            double    convexity          = hwProvider.futuresConvexityFactor(future.LastTradeDate, fixingStartDate, fixingEndDate);

            return(convexity * forward - (1d - convexity) / fixingYearFraction);
        }
        /// <summary>
        /// Calculates the price sensitivity of the Ibor future product.
        /// <para>
        /// The price sensitivity of the product is the sensitivity of the price to the underlying curves.
        ///
        /// </para>
        /// </summary>
        /// <param name="future">  the future </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="hwProvider">  the Hull-White model parameter provider </param>
        /// <returns> the price curve sensitivity of the product </returns>
        public virtual PointSensitivities priceSensitivityRates(ResolvedIborFuture future, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider)
        {
            IborIndexObservation obs             = future.IborRate.Observation;
            LocalDate            fixingStartDate = obs.EffectiveDate;
            LocalDate            fixingEndDate   = obs.MaturityDate;
            double convexity          = hwProvider.futuresConvexityFactor(future.LastTradeDate, fixingStartDate, fixingEndDate);
            IborRateSensitivity sensi = IborRateSensitivity.of(obs, -convexity);

            // The sensitivity should be to no currency or currency XXX. To avoid useless conversion, the dimension-less
            // price sensitivity is reported in the future currency.
            return(PointSensitivities.of(sensi));
        }
Пример #3
0
        public virtual void test_price()
        {
            double    computed           = PRICER.price(FUTURE, RATE_PROVIDER, HW_PROVIDER);
            LocalDate start              = FUTURE.IborRate.Observation.EffectiveDate;
            LocalDate end                = FUTURE.IborRate.Observation.MaturityDate;
            double    fixingYearFraction = FUTURE.IborRate.Observation.YearFraction;
            double    convexity          = HW_PROVIDER.futuresConvexityFactor(FUTURE.LastTradeDate, start, end);
            double    forward            = RATE_PROVIDER.iborIndexRates(EUR_EURIBOR_3M).rate(FUTURE.IborRate.Observation);
            double    expected           = 1d - convexity * forward + (1d - convexity) / fixingYearFraction;

            assertEquals(computed, expected, TOL);
        }