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 classInflationNodalCurve.MetaThe meta-bean forInflationNodalCurve.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)doublefirstDerivative(double x)Computes the first derivative of the curve.ShiftTypegetAdjustmentType()Gets the shift type applied to the unadjusted value and the adjustment.CurveMetadatagetMetadata()Gets the curve metadata.doublegetParameter(int parameterIndex)Gets the value of the parameter at the specified index.intgetParameterCount()Gets the number of parameters.ParameterMetadatagetParameterMetadata(int parameterIndex)Gets the metadata of the parameter at the specified index.DoubleArraygetSeasonality()Gets describes the monthly seasonal adjustments.NodalCurvegetUnderlying()Gets the underlying curve, before the seasonality adjustment.DoubleArraygetXValues()Gets the known x-values of the curve.DoubleArraygetYValues()Gets the known y-values of the curve.inthashCode()static InflationNodalCurve.Metameta()The meta-bean forInflationNodalCurve.InflationNodalCurve.MetametaBean()static InflationNodalCurveof(NodalCurve curve, DoubleArray seasonality, ShiftType adjustmentType)Obtains an instance of the curve.static InflationNodalCurveof(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.StringtoString()InflationNodalCurvewithMetadata(CurveMetadata metadata)Returns a new curve with the specified metadata.InflationNodalCurvewithNode(double x, double y, ParameterMetadata paramMetadata)Returns a new curve with an additional node, specifying the parameter metadata.InflationNodalCurvewithParameter(int parameterIndex, double newValue)Returns a copy of the data with the value at the specified index altered.InflationNodalCurvewithValues(DoubleArray xValues, DoubleArray yValues)Returns a new curve with the specified x-values and y-values.InflationNodalCurvewithYValues(DoubleArray values)Returns a new curve with the specified values.doubleyValue(double x)Computes the y-value for the specified x-value.UnitParameterSensitivityyValueParameterSensitivity(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:CurveGets 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:
getMetadatain interfaceCurve- Returns:
- the metadata
-
yValue
public double yValue(double x)
Description copied from interface:CurveComputes the y-value for the specified x-value.
-
getParameterCount
public int getParameterCount()
Description copied from interface:ParameterizedDataGets 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:
getParameterCountin interfaceParameterizedData- Returns:
- the number of parameters
-
getParameter
public double getParameter(int parameterIndex)
Description copied from interface:ParameterizedDataGets the value of the parameter at the specified index.- Specified by:
getParameterin 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:NodalCurveGets the metadata of the parameter at the specified index.If there is no specific parameter metadata,
SimpleCurveParameterMetadatawill be created.- Specified by:
getParameterMetadatain interfaceCurve- Specified by:
getParameterMetadatain interfaceNodalCurve- Specified by:
getParameterMetadatain 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:NodalCurveGets 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:
getXValuesin interfaceNodalCurve- Returns:
- the x-values
-
getYValues
public DoubleArray getYValues()
Description copied from interface:NodalCurveGets 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:
getYValuesin interfaceNodalCurve- Returns:
- the y-values
-
yValueParameterSensitivity
public UnitParameterSensitivity yValueParameterSensitivity(double x)
Description copied from interface:CurveComputes 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:
yValueParameterSensitivityin 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:CurveComputes the first derivative of the curve.The first derivative is
dy/dx.- Specified by:
firstDerivativein 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:NodalCurveReturns 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:
withMetadatain interfaceCurve- Specified by:
withMetadatain interfaceNodalCurve- Parameters:
metadata- the new metadata for the curve- Returns:
- the new curve
-
withYValues
public InflationNodalCurve withYValues(DoubleArray values)
Description copied from interface:NodalCurveReturns 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:
withYValuesin 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:NodalCurveReturns 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:
withValuesin 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:ParameterizedDataReturns 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:
withParameterin interfaceCurve- Specified by:
withParameterin interfaceNodalCurve- Specified by:
withParameterin 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:NodalCurveReturns 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:
withNodein 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:
metaBeanin 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
-
-