// interpolate the observations at the end
        private PointSensitivityBuilder endSensitivity(InflationInterpolatedRateComputation computation, PriceIndexValues values)
        {
            double weight = computation.Weight;
            PointSensitivityBuilder sensi1 = values.valuePointSensitivity(computation.EndObservation).multipliedBy(weight);
            PointSensitivityBuilder sensi2 = values.valuePointSensitivity(computation.EndSecondObservation).multipliedBy(1d - weight);

            return(sensi1.combinedWith(sensi2));
        }
Beispiel #2
0
        public virtual PointSensitivityBuilder rateSensitivity(InflationMonthlyRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)
        {
            PriceIndex              index         = computation.Index;
            PriceIndexValues        values        = provider.priceIndexValues(index);
            double                  indexStart    = values.value(computation.StartObservation);
            double                  indexEnd      = values.value(computation.EndObservation);
            double                  indexStartInv = 1d / indexStart;
            PointSensitivityBuilder sensi1        = values.valuePointSensitivity(computation.StartObservation).multipliedBy(-indexEnd * indexStartInv * indexStartInv);
            PointSensitivityBuilder sensi2        = values.valuePointSensitivity(computation.EndObservation).multipliedBy(indexStartInv);

            return(sensi1.combinedWith(sensi2));
        }
        public virtual PointSensitivityBuilder rateSensitivity(InflationEndMonthRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider)
        {
            PriceIndexValues values = provider.priceIndexValues(computation.Index);

            return(values.valuePointSensitivity(computation.EndObservation).multipliedBy(1d / computation.StartIndexValue));
        }