Class RatesCurveGroupDefinition

  • All Implemented Interfaces:
    CurveGroupDefinition, java.io.Serializable, Bean, ImmutableBean

    public final class RatesCurveGroupDefinition
    extends java.lang.Object
    implements CurveGroupDefinition, ImmutableBean, java.io.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
    • 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,
                                                   java.util.Collection<RatesCurveGroupEntry> entries,
                                                   java.util.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 group
        entries - entries describing the curves in the group
        curveDefinitions - 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,
                                                   java.util.Collection<RatesCurveGroupEntry> entries,
                                                   java.util.Collection<CurveDefinition> curveDefinitions,
                                                   java.util.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 group
        entries - entries describing the curves in the group
        curveDefinitions - definitions which specify how the curves are calibrated
        seasonalityDefinitions - definitions which specify the seasonality to use for different curves
        Returns:
        a curve group definition with the specified name and containing the specified entries
      • filtered

        public RatesCurveGroupDefinition filtered​(java.time.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 date
        refData - the reference data
        Returns:
        the resolved definition, that should be used in preference to this one
        Throws:
        java.lang.IllegalArgumentException - if the curve nodes are invalid
      • bindTimeSeries

        public RatesCurveGroupDefinition bindTimeSeries​(java.time.LocalDate valuationDate,
                                                        java.util.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 date
        tsMap - the map of index to time series
        Returns:
        the new instance
      • findDiscountCurveName

        public java.util.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 java.util.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 com.google.common.collect.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 java.util.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 java.util.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 com.google.common.collect.ImmutableList<CurveMetadata> metadata​(java.time.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 date
        refData - 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), and initialGuesses(MarketData) will be of this size.

        Returns:
        the number of parameters
      • resolvedTrades

        public com.google.common.collect.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 date
        refData - the reference data, used to resolve the trades
        Returns:
        the list of all trades
      • initialGuesses

        public com.google.common.collect.ImmutableList<java.lang.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​(java.util.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​(java.util.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:
        java.lang.IllegalArgumentException - if unable to merge
      • getEntries

        public com.google.common.collect.ImmutableList<RatesCurveGroupEntry> getEntries()
        Gets the configuration for building the curves in the group.
        Returns:
        the value of the property, not null
      • getCurveDefinitions

        public com.google.common.collect.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 com.google.common.collect.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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object