Example #1
0
        //-------------------------------------------------------------------------
        public virtual double rate(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);

            return(indexEnd / indexStart - 1d);
        }
Example #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));
        }
Example #3
0
        public virtual double explainRate(InflationMonthlyRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder)
        {
            PriceIndex       index      = computation.Index;
            PriceIndexValues values     = provider.priceIndexValues(index);
            double           indexStart = values.value(computation.StartObservation);
            double           indexEnd   = values.value(computation.EndObservation);

            builder.addListEntry(ExplainKey.OBSERVATIONS, child => child.put(ExplainKey.ENTRY_TYPE, "InflationObservation").put(ExplainKey.FIXING_DATE, computation.StartObservation.FixingMonth.atEndOfMonth()).put(ExplainKey.INDEX, index).put(ExplainKey.INDEX_VALUE, indexStart));
            builder.addListEntry(ExplainKey.OBSERVATIONS, child => child.put(ExplainKey.ENTRY_TYPE, "InflationObservation").put(ExplainKey.FIXING_DATE, computation.EndObservation.FixingMonth.atEndOfMonth()).put(ExplainKey.INDEX, index).put(ExplainKey.INDEX_VALUE, indexEnd));
            double rate = this.rate(computation, startDate, endDate, provider);

            builder.put(ExplainKey.COMBINED_RATE, rate);
            return(rate);
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "floatLeg") public void test_float_leg(FixedInflationSwapConvention convention, com.opengamma.strata.basics.index.PriceIndex floatLeg)
        public virtual void test_float_leg(FixedInflationSwapConvention convention, PriceIndex floatLeg)
        {
            assertEquals(convention.FloatingLeg.Index, floatLeg);
        }
 public virtual PriceIndexValues priceIndexValues(PriceIndex index)
 {
     throw new System.NotSupportedException();
 }