Class InflationNodalCurve

  • All Implemented Interfaces:
    Curve, NodalCurve, ParameterizedData, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class InflationNodalCurve
    extends Object
    implements NodalCurve, org.joda.beans.ImmutableBean, Serializable
    Curve specifically designed for inflation, with features for seasonality and initial point.

    The curve details with the initial point and the total seasonal adjustment for each month can be directly provided. Alternatively, the curve without the initial point and the seasonality as a month-on-month can be provided and the final curve computed from there.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static InflationNodalCurve of​(NodalCurve curve,
                                             DoubleArray seasonality,
                                             ShiftType adjustmentType)
        Obtains an instance of the curve.

        The seasonal adjustment is the total adjustment for each month, starting with January.

        See of(NodalCurve, LocalDate, YearMonth, double, SeasonalityDefinition) for month-on-month adjustments and the adjustment starting point, including locking the last fixing.

        Parameters:
        curve - the curve with initial fixing
        seasonality - the total seasonal adjustment for each month, with the first element the January adjustment
        adjustmentType - the adjustment type
        Returns:
        the seasonal curve instance
      • of

        public static InflationNodalCurve of​(NodalCurve curveWithoutFixing,
                                             LocalDate valuationDate,
                                             YearMonth lastMonth,
                                             double lastFixingValue,
                                             SeasonalityDefinition seasonalityDefinition)
        Obtains an instance from a curve without initial fixing point and month-on-month seasonal adjustment.

        The total adjustment is computed by accumulation of the monthly adjustment, starting with no adjustment for the last fixing month.

        Parameters:
        curveWithoutFixing - the curve without the fixing
        valuationDate - the valuation date of the curve
        lastMonth - the last month for which the fixing is known
        lastFixingValue - the value of the last fixing
        seasonalityDefinition - the seasonality definition, which is made of month-on-month adjustment and the adjustment type
        Returns:
        the seasonal curve instance
      • getMetadata

        public CurveMetadata getMetadata()
        Description copied from interface: Curve
        Gets the curve metadata.

        This method returns metadata about the curve and the curve parameters.

        For example, a curve may be defined based on financial instruments. The parameters might represent 1 day, 1 week, 1 month, 3 months, 6 months and 12 months. The metadata could be used to describe each parameter in terms of a Period.

        The metadata includes an optional list of parameter metadata. If parameter metadata is present, the size of the list will match the number of parameters of this curve.

        Specified by:
        getMetadata in interface Curve
        Returns:
        the metadata
      • yValue

        public double yValue​(double x)
        Description copied from interface: Curve
        Computes the y-value for the specified x-value.
        Specified by:
        yValue in interface Curve
        Parameters:
        x - the x-value to find the y-value for
        Returns:
        the value at the x-value
      • getParameterCount

        public int getParameterCount()
        Description copied from interface: ParameterizedData
        Gets the number of parameters.

        This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.

        Specified by:
        getParameterCount in interface ParameterizedData
        Returns:
        the number of parameters
      • getParameter

        public double getParameter​(int parameterIndex)
        Description copied from interface: ParameterizedData
        Gets the value of the parameter at the specified index.
        Specified by:
        getParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        Returns:
        the value of the parameter
      • getXValues

        public DoubleArray getXValues()
        Description copied from interface: NodalCurve
        Gets the known x-values of the curve.

        This method returns the fixed x-values used to define the curve. This will be of the same size as the y-values.

        Specified by:
        getXValues in interface NodalCurve
        Returns:
        the x-values
      • getYValues

        public DoubleArray getYValues()
        Description copied from interface: NodalCurve
        Gets the known y-values of the curve.

        This method returns the fixed y-values used to define the curve. This will be of the same size as the x-values.

        Specified by:
        getYValues in interface NodalCurve
        Returns:
        the y-values
      • yValueParameterSensitivity

        public UnitParameterSensitivity yValueParameterSensitivity​(double x)
        Description copied from interface: Curve
        Computes the sensitivity of the y-value with respect to the curve parameters.

        This returns an array with one element for each parameter of the curve. The array contains the sensitivity of the y-value at the specified x-value to each parameter.

        Specified by:
        yValueParameterSensitivity in interface Curve
        Parameters:
        x - the x-value at which the parameter sensitivity is computed
        Returns:
        the sensitivity
      • firstDerivative

        public double firstDerivative​(double x)
        Description copied from interface: Curve
        Computes the first derivative of the curve.

        The first derivative is dy/dx.

        Specified by:
        firstDerivative in interface Curve
        Parameters:
        x - the x-value at which the derivative is taken
        Returns:
        the first derivative
      • withMetadata

        public InflationNodalCurve withMetadata​(CurveMetadata metadata)
        Description copied from interface: NodalCurve
        Returns a new curve with the specified metadata.

        This allows the metadata of the curve to be changed while retaining all other information. If parameter metadata is present, the size of the list must match the number of parameters of this curve.

        Specified by:
        withMetadata in interface Curve
        Specified by:
        withMetadata in interface NodalCurve
        Parameters:
        metadata - the new metadata for the curve
        Returns:
        the new curve
      • withYValues

        public InflationNodalCurve withYValues​(DoubleArray values)
        Description copied from interface: NodalCurve
        Returns a new curve with the specified values.

        This allows the y-values of the curve to be changed while retaining the same x-values.

        Specified by:
        withYValues in interface NodalCurve
        Parameters:
        values - the new y-values for the curve
        Returns:
        the new curve
      • withValues

        public InflationNodalCurve withValues​(DoubleArray xValues,
                                              DoubleArray yValues)
        Description copied from interface: NodalCurve
        Returns a new curve with the specified x-values and y-values.

        This allows the x values and y-values of the curve to be changed.

        Specified by:
        withValues in interface NodalCurve
        Parameters:
        xValues - the new x-values for the curve
        yValues - the new y-values for the curve
        Returns:
        the new curve
      • withParameter

        public InflationNodalCurve withParameter​(int parameterIndex,
                                                 double newValue)
        Description copied from interface: ParameterizedData
        Returns a copy of the data with the value at the specified index altered.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withParameter in interface Curve
        Specified by:
        withParameter in interface NodalCurve
        Specified by:
        withParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - the new value for the specified parameter
        Returns:
        a parameterized data instance based on this with the specified parameter altered
      • withNode

        public InflationNodalCurve withNode​(double x,
                                            double y,
                                            ParameterMetadata paramMetadata)
        Description copied from interface: NodalCurve
        Returns a new curve with an additional node, specifying the parameter metadata.

        The result will contain the specified node. If the x-value equals an existing x-value, the y-value will be changed. If the x-value does not equal an existing x-value, the node will be added.

        The result will only contain the specified parameter metadata if this curve also has parameter meta-data.

        Specified by:
        withNode in interface NodalCurve
        Parameters:
        x - the new x-value
        y - the new y-value
        paramMetadata - the new parameter metadata
        Returns:
        the updated curve
      • meta

        public static InflationNodalCurve.Meta meta()
        The meta-bean for InflationNodalCurve.
        Returns:
        the meta-bean, not null
      • getUnderlying

        public NodalCurve getUnderlying()
        Gets the underlying curve, before the seasonality adjustment. This includes the fixed initial value, which is not treated as a parameter.
        Returns:
        the value of the property, not null
      • getSeasonality

        public DoubleArray getSeasonality()
        Gets describes the monthly seasonal adjustments. The array has a dimension of 12, one element for each month. The adjustments are described as a perturbation to the existing values. No adjustment to the fixing value.
        Returns:
        the value of the property, not null
      • getAdjustmentType

        public ShiftType getAdjustmentType()
        Gets the shift type applied to the unadjusted value and the adjustment. (value, seasonality) -> adjustmentType.applyShift(value, seasonality).
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object