Class RatesCurveGroupDefinition
- java.lang.Object
-
- com.opengamma.strata.market.curve.RatesCurveGroupDefinition
-
- All Implemented Interfaces:
CurveGroupDefinition
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class RatesCurveGroupDefinition extends Object implements CurveGroupDefinition, org.joda.beans.ImmutableBean, Serializable
Provides the definition of how to calibrate a group of curves.A curve group contains one or more entries, each of which contains the definition of a curve and a set of currencies and indices specifying how the curve is to be used. The currencies are used to specify that the curve is to be used as a discount curve. The indices are used to specify that the curve is to be used as a forward curve.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RatesCurveGroupDefinition.Meta
The meta-bean forRatesCurveGroupDefinition
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RatesCurveGroupDefinition
bindTimeSeries(LocalDate valuationDate, Map<Index,LocalDateDoubleTimeSeries> tsMap)
Returns a definition that is bound to a time-series.static RatesCurveGroupDefinitionBuilder
builder()
Returns a mutable builder for building the definition for a curve group.RatesCurveGroupDefinition
combinedWith(RatesCurveGroupDefinition other)
Combines this definition with another one.RatesCurveGroupId
createGroupId(ObservableSource source)
Creates an identifier that can be used to resolve this definition.boolean
equals(Object obj)
RatesCurveGroupDefinition
filtered(LocalDate valuationDate, ReferenceData refData)
Returns a filtered version of this definition with no invalid nodes.Optional<CurveDefinition>
findCurveDefinition(CurveName curveName)
Finds the definition for the curve with the specified name.Optional<CurveName>
findDiscountCurveName(Currency discountCurrency)
Finds the discount curve name for the specified currency.Optional<RatesCurveGroupEntry>
findEntry(CurveName curveName)
Finds the entry for the curve with the specified name.Optional<CurveName>
findForwardCurveName(Index forwardIndex)
Finds the forward curve name for the specified index.ImmutableSet<CurveName>
findForwardCurveNames(FloatingRateName forwardName)
Finds the forward curve names for the specified floating rate name.ImmutableList<CurveDefinition>
getCurveDefinitions()
Gets definitions which specify how the curves are calibrated.ImmutableList<RatesCurveGroupEntry>
getEntries()
Gets the configuration for building the curves in the group.CurveGroupName
getName()
Gets the name of the curve group.ImmutableMap<CurveName,SeasonalityDefinition>
getSeasonalityDefinitions()
Gets definitions which specify which seasonality should be used for some price index curves.int
getTotalParameterCount()
Gets the total number of parameters in the group.int
hashCode()
ImmutableList<Double>
initialGuesses(MarketData marketData)
Gets the list of all initial guesses.boolean
isComputeJacobian()
Gets the flag indicating if the Jacobian matrices should be computed and stored in metadata or not.boolean
isComputePvSensitivityToMarketQuote()
Gets the flag indicating if present value sensitivity to market quotes should be computed and stored in metadata or not.static RatesCurveGroupDefinition.Meta
meta()
The meta-bean forRatesCurveGroupDefinition
.RatesCurveGroupDefinition.Meta
metaBean()
ImmutableList<CurveMetadata>
metadata(LocalDate valuationDate, ReferenceData refData)
Creates the curve metadata for each definition.static RatesCurveGroupDefinition
of(CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions)
Returns a curve group definition with the specified name and containing the specified entries.static RatesCurveGroupDefinition
of(CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions, Map<CurveName,SeasonalityDefinition> seasonalityDefinitions)
Returns a curve group definition with the specified name and containing the specified entries and seasonality.ImmutableList<ResolvedTrade>
resolvedTrades(MarketData marketData, ReferenceData refData)
Creates a list of trades representing the instrument at each node.RatesCurveGroupDefinitionBuilder
toBuilder()
Converts to builder.String
toString()
RatesCurveGroupDefinition
withCurveDefinitions(List<CurveDefinition> curveDefinitions)
Returns a copy of this object containing the specified curve definitions.RatesCurveGroupDefinition
withName(CurveGroupName name)
Returns a copy of this definition with a different name.RatesCurveGroupDefinition
withSeasonalityDefinitions(Map<CurveName,SeasonalityDefinition> seasonalityDefinitions)
Returns a copy of this object containing the specified seasonality definitions.
-
-
-
Method Detail
-
builder
public static RatesCurveGroupDefinitionBuilder builder()
Returns a mutable builder for building the definition for a curve group.- Returns:
- a mutable builder for building the definition for a curve group
-
of
public static RatesCurveGroupDefinition of(CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions)
Returns a curve group definition with the specified name and containing the specified entries.The Jacobian matrices are computed. The Present Value sensitivity to Market quotes are not computed.
- Parameters:
name
- the name of the curve groupentries
- entries describing the curves in the groupcurveDefinitions
- definitions which specify how the curves are calibrated- Returns:
- a curve group definition with the specified name and containing the specified entries
-
of
public static RatesCurveGroupDefinition of(CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions, Map<CurveName,SeasonalityDefinition> seasonalityDefinitions)
Returns a curve group definition with the specified name and containing the specified entries and seasonality.The Jacobian matrices are computed. The Present Value sensitivity to Market quotes are not computed.
- Parameters:
name
- the name of the curve groupentries
- entries describing the curves in the groupcurveDefinitions
- definitions which specify how the curves are calibratedseasonalityDefinitions
- definitions which specify the seasonality to use for different curves- Returns:
- a curve group definition with the specified name and containing the specified entries
-
createGroupId
public RatesCurveGroupId createGroupId(ObservableSource source)
Description copied from interface:CurveGroupDefinition
Creates an identifier that can be used to resolve this definition.- Specified by:
createGroupId
in interfaceCurveGroupDefinition
- Parameters:
source
- the source of data- Returns:
- the curve, empty if not found
-
filtered
public RatesCurveGroupDefinition filtered(LocalDate valuationDate, ReferenceData refData)
Returns a filtered version of this definition with no invalid nodes.A curve is formed of a number of nodes, each of which has an associated date. To be valid, the curve node dates must be in order from earliest to latest. This method applies rules to remove invalid nodes.
- Parameters:
valuationDate
- the valuation daterefData
- the reference data- Returns:
- the resolved definition, that should be used in preference to this one
- Throws:
IllegalArgumentException
- if the curve nodes are invalid
-
bindTimeSeries
public RatesCurveGroupDefinition bindTimeSeries(LocalDate valuationDate, Map<Index,LocalDateDoubleTimeSeries> tsMap)
Returns a definition that is bound to a time-series.Curves related to a price index are better described when a starting point is added with the last fixing in the time series. This method finds price index curves, and ensures that they are unique (not used for any other index or discounting). Each price index curve is then bound to the matching time-series with the last fixing month equal to the last element in the time series which is in the past.
- Parameters:
valuationDate
- the valuation datetsMap
- the map of index to time series- Returns:
- the new instance
-
findDiscountCurveName
public Optional<CurveName> findDiscountCurveName(Currency discountCurrency)
Finds the discount curve name for the specified currency.If the curve name is not found, optional empty is returned.
- Parameters:
discountCurrency
- the currency to find a discount curve name for- Returns:
- the curve name
-
findForwardCurveName
public Optional<CurveName> findForwardCurveName(Index forwardIndex)
Finds the forward curve name for the specified index.If the curve name is not found, optional empty is returned.
- Parameters:
forwardIndex
- the index to find a forward curve name for- Returns:
- the curve name
-
findForwardCurveNames
public ImmutableSet<CurveName> findForwardCurveNames(FloatingRateName forwardName)
Finds the forward curve names for the specified floating rate name.If the curve name is not found, optional empty is returned.
- Parameters:
forwardName
- the floating rate name to find a forward curve name for- Returns:
- the set of curve names
-
findEntry
public Optional<RatesCurveGroupEntry> findEntry(CurveName curveName)
Finds the entry for the curve with the specified name.If the curve is not found, optional empty is returned.
- Parameters:
curveName
- the name of the curve- Returns:
- the entry for the curve with the specified name
-
findCurveDefinition
public Optional<CurveDefinition> findCurveDefinition(CurveName curveName)
Finds the definition for the curve with the specified name.If the curve is not found, optional empty is returned.
- Parameters:
curveName
- the name of the curve- Returns:
- the definition for the curve with the specified name
-
metadata
public ImmutableList<CurveMetadata> metadata(LocalDate valuationDate, ReferenceData refData)
Creates the curve metadata for each definition.This method returns a list of metadata, one for each curve definition.
- Parameters:
valuationDate
- the valuation daterefData
- the reference data- Returns:
- the metadata
-
getTotalParameterCount
public int getTotalParameterCount()
Gets the total number of parameters in the group.This returns the total number of parameters in the group, which equals the number of nodes. The result of
resolvedTrades(MarketData, ReferenceData)
, andinitialGuesses(MarketData)
will be of this size.- Returns:
- the number of parameters
-
resolvedTrades
public ImmutableList<ResolvedTrade> resolvedTrades(MarketData marketData, ReferenceData refData)
Creates a list of trades representing the instrument at each node.This uses the observed market data to build the trade that each node represents. The result combines the list of trades from each curve in order. Each trade is created with a quantity of 1. The valuation date is defined by the market data.
- Parameters:
marketData
- the market data required to build a trade for the instrument, including the valuation daterefData
- the reference data, used to resolve the trades- Returns:
- the list of all trades
-
initialGuesses
public ImmutableList<Double> initialGuesses(MarketData marketData)
Gets the list of all initial guesses.This returns a list that combines the list of initial guesses from each curve in order. The valuation date is defined by the market data.
- Parameters:
marketData
- the market data required to build a trade for the instrument, including the valuation date- Returns:
- the list of all initial guesses
-
withCurveDefinitions
public RatesCurveGroupDefinition withCurveDefinitions(List<CurveDefinition> curveDefinitions)
Returns a copy of this object containing the specified curve definitions.Curves are ignored if there is no entry in this definition with the same curve name.
- Parameters:
curveDefinitions
- curve definitions- Returns:
- a copy of this object containing the specified curve definitions
-
withSeasonalityDefinitions
public RatesCurveGroupDefinition withSeasonalityDefinitions(Map<CurveName,SeasonalityDefinition> seasonalityDefinitions)
Returns a copy of this object containing the specified seasonality definitions.Seasonality definitions are ignored if there is no entry in this definition with the same curve name.
- Parameters:
seasonalityDefinitions
- seasonality definitions- Returns:
- a copy of this object containing the specified seasonality definitions
-
withName
public RatesCurveGroupDefinition withName(CurveGroupName name)
Returns a copy of this definition with a different name.- Parameters:
name
- the name of the new curve group definition- Returns:
- a copy of this curve group definition with a different name
-
combinedWith
public RatesCurveGroupDefinition combinedWith(RatesCurveGroupDefinition other)
Combines this definition with another one.This combines the curve definitions, curve entries and seasonality with those from the other definition. An exception is thrown if unable to merge, such as if the curve definitions clash. The group name will be taken from this definition only. The seasonality will be taken from this definition only if there is a clash. The boolean flags will be combined using logical OR.
- Parameters:
other
- the other definition- Returns:
- the combined curve group definition
- Throws:
IllegalArgumentException
- if unable to merge
-
toBuilder
public RatesCurveGroupDefinitionBuilder toBuilder()
Converts to builder.- Returns:
- the builder
-
meta
public static RatesCurveGroupDefinition.Meta meta()
The meta-bean forRatesCurveGroupDefinition
.- Returns:
- the meta-bean, not null
-
metaBean
public RatesCurveGroupDefinition.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getName
public CurveGroupName getName()
Gets the name of the curve group.- Specified by:
getName
in interfaceCurveGroupDefinition
- Returns:
- the value of the property, not null
-
getEntries
public ImmutableList<RatesCurveGroupEntry> getEntries()
Gets the configuration for building the curves in the group.- Returns:
- the value of the property, not null
-
getCurveDefinitions
public ImmutableList<CurveDefinition> getCurveDefinitions()
Gets definitions which specify how the curves are calibrated.Curve definitions are required for curves that need to be calibrated. A definition is not necessary if the curve is not built by the Strata curve calibrator.
- Returns:
- the value of the property, not null
-
getSeasonalityDefinitions
public ImmutableMap<CurveName,SeasonalityDefinition> getSeasonalityDefinitions()
Gets definitions which specify which seasonality should be used for some price index curves.If a curve linked to a price index does not have an entry in the map, no seasonality is used for that curve.
- Returns:
- the value of the property, not null
-
isComputeJacobian
public boolean isComputeJacobian()
Gets the flag indicating if the Jacobian matrices should be computed and stored in metadata or not.- Returns:
- the value of the property
-
isComputePvSensitivityToMarketQuote
public boolean isComputePvSensitivityToMarketQuote()
Gets the flag indicating if present value sensitivity to market quotes should be computed and stored in metadata or not.- Returns:
- the value of the property
-
-