Class InflationNodalCurve
- java.lang.Object
-
- com.opengamma.strata.market.curve.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InflationNodalCurve.Meta
The meta-bean forInflationNodalCurve
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
double
firstDerivative(double x)
Computes the first derivative of the curve.ShiftType
getAdjustmentType()
Gets the shift type applied to the unadjusted value and the adjustment.CurveMetadata
getMetadata()
Gets the curve metadata.double
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.int
getParameterCount()
Gets the number of parameters.ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.DoubleArray
getSeasonality()
Gets describes the monthly seasonal adjustments.NodalCurve
getUnderlying()
Gets the underlying curve, before the seasonality adjustment.DoubleArray
getXValues()
Gets the known x-values of the curve.DoubleArray
getYValues()
Gets the known y-values of the curve.int
hashCode()
static InflationNodalCurve.Meta
meta()
The meta-bean forInflationNodalCurve
.InflationNodalCurve.Meta
metaBean()
static InflationNodalCurve
of(NodalCurve curve, DoubleArray seasonality, ShiftType adjustmentType)
Obtains an instance of the curve.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.String
toString()
InflationNodalCurve
withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.InflationNodalCurve
withNode(double x, double y, ParameterMetadata paramMetadata)
Returns a new curve with an additional node, specifying the parameter metadata.InflationNodalCurve
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.InflationNodalCurve
withValues(DoubleArray xValues, DoubleArray yValues)
Returns a new curve with the specified x-values and y-values.InflationNodalCurve
withYValues(DoubleArray values)
Returns a new curve with the specified values.double
yValue(double x)
Computes the y-value for the specified x-value.UnitParameterSensitivity
yValueParameterSensitivity(double x)
Computes the sensitivity of the y-value with respect to the curve parameters.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.market.curve.Curve
createParameterSensitivity, createParameterSensitivity, findParameterIndex, getName, split, withUnderlyingCurve
-
Methods inherited from interface com.opengamma.strata.market.curve.NodalCurve
values, withPerturbation
-
-
-
-
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 fixingseasonality
- the total seasonal adjustment for each month, with the first element the January adjustmentadjustmentType
- 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 fixingvaluationDate
- the valuation date of the curvelastMonth
- the last month for which the fixing is knownlastFixingValue
- the value of the last fixingseasonalityDefinition
- 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 interfaceCurve
- Returns:
- the metadata
-
yValue
public double yValue(double x)
Description copied from interface:Curve
Computes the y-value for the specified 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 interfaceParameterizedData
- 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 interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the value of the parameter
-
getParameterMetadata
public ParameterMetadata getParameterMetadata(int parameterIndex)
Description copied from interface:NodalCurve
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata,
SimpleCurveParameterMetadata
will be created.- Specified by:
getParameterMetadata
in interfaceCurve
- Specified by:
getParameterMetadata
in interfaceNodalCurve
- Specified by:
getParameterMetadata
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata 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 interfaceNodalCurve
- 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 interfaceNodalCurve
- 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 interfaceCurve
- 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 interfaceCurve
- 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 interfaceCurve
- Specified by:
withMetadata
in interfaceNodalCurve
- 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 interfaceNodalCurve
- 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 interfaceNodalCurve
- Parameters:
xValues
- the new x-values for the curveyValues
- 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 interfaceCurve
- Specified by:
withParameter
in interfaceNodalCurve
- Specified by:
withParameter
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to getnewValue
- 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 interfaceNodalCurve
- Parameters:
x
- the new x-valuey
- the new y-valueparamMetadata
- the new parameter metadata- Returns:
- the updated curve
-
meta
public static InflationNodalCurve.Meta meta()
The meta-bean forInflationNodalCurve
.- Returns:
- the meta-bean, not null
-
metaBean
public InflationNodalCurve.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
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
-
-