Interface CurveMetadata
-
- All Known Implementing Classes:
DefaultCurveMetadata
public interface CurveMetadata
Metadata about a curve and curve parameters.Implementations of this interface are used to store metadata about a curve. For example, a curve may be defined based on financial instruments. The parameters might represent 1 day, 1 week, 1 month, 3 month and 6 months. The metadata could be used to describe each parameter in terms of a
Tenor
.This metadata can be used by applications to interpret the parameters of the curve. For example, the scenario framework uses the data when applying perturbations.
See
Curves
for helper methods that create common curve types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> Optional<T>
findInfo(CurveInfoType<T> type)
Finds curve information of a specific type.default OptionalInt
findParameterIndex(ParameterMetadata metadata)
Finds the parameter index of the specified metadata.CurveName
getCurveName()
Gets the curve name.default <T> T
getInfo(CurveInfoType<T> type)
Gets curve information of a specific type.Optional<List<ParameterMetadata>>
getParameterMetadata()
Gets metadata about each parameter underlying the curve, optional.default ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.ValueType
getXValueType()
Gets the x-value type, providing meaning to the x-values of the curve.ValueType
getYValueType()
Gets the y-value type, providing meaning to the y-values of the curve.<T> DefaultCurveMetadata
withInfo(CurveInfoType<T> type, T value)
Returns an instance where the specified additional information has been added.CurveMetadata
withParameterMetadata(List<? extends ParameterMetadata> parameterMetadata)
Returns an instance where the parameter metadata has been changed.
-
-
-
Method Detail
-
getCurveName
CurveName getCurveName()
Gets the curve name.- Returns:
- the curve name
-
getXValueType
ValueType getXValueType()
Gets the x-value type, providing meaning to the x-values of the curve.This type provides meaning to the x-values. For example, the x-value might represent a year fraction, as represented using
ValueType.YEAR_FRACTION
.Note that if the x-value of the curve represents time as a year fraction, the day count should be specified in the info map to define how the year fraction is calculated.
- Returns:
- the x-value type
-
getYValueType
ValueType getYValueType()
Gets the y-value type, providing meaning to the y-values of the curve.This type provides meaning to the y-values. For example, the y-value might represent a zero rate, as represented using
ValueType.ZERO_RATE
.- Returns:
- the y-value type
-
getInfo
default <T> T getInfo(CurveInfoType<T> type)
Gets curve information of a specific type.If the information is not found, an exception is thrown.
The most common information is the day count and curve calibration information.
- Type Parameters:
T
- the type of the info- Parameters:
type
- the type to find- Returns:
- the curve information
- Throws:
IllegalArgumentException
- if the information is not found
-
findInfo
<T> Optional<T> findInfo(CurveInfoType<T> type)
Finds curve information of a specific type.If the info is not found, optional empty is returned.
The most common information is the day count and curve calibration information.
- Type Parameters:
T
- the type of the info- Parameters:
type
- the type to find- Returns:
- the curve information
-
getParameterMetadata
default ParameterMetadata getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
- Throws:
IndexOutOfBoundsException
- if the index is invalid
-
getParameterMetadata
Optional<List<ParameterMetadata>> getParameterMetadata()
Gets metadata about each parameter underlying the curve, optional.If present, the parameter metadata will match the number of parameters on the curve.
- Returns:
- the parameter metadata
-
findParameterIndex
default OptionalInt findParameterIndex(ParameterMetadata metadata)
Finds the parameter index of the specified metadata.If the parameter metadata is not matched, an empty optional will be returned.
- Parameters:
metadata
- the parameter metadata to find the index of- Returns:
- the index of the parameter
-
withInfo
<T> DefaultCurveMetadata withInfo(CurveInfoType<T> type, T value)
Returns an instance where the specified additional information has been added.The additional information is stored in the result using
Map.put
semantics, removing the key if the instance is null.- Type Parameters:
T
- the type of the info- Parameters:
type
- the type to store undervalue
- the value to store, may be null- Returns:
- the new curve metadata
-
withParameterMetadata
CurveMetadata withParameterMetadata(List<? extends ParameterMetadata> parameterMetadata)
Returns an instance where the parameter metadata has been changed.The result will contain the specified parameter metadata. A null value is accepted and causes the result to have no parameter metadata.
- Parameters:
parameterMetadata
- the new parameter metadata, may be null- Returns:
- the new curve metadata
-
-