Class RatesCurveGroup

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

    public final class RatesCurveGroup
    extends java.lang.Object
    implements CurveGroup, ImmutableBean, java.io.Serializable
    A group of curves.

    This is used to hold a group of related curves, typically forming a logical set. It is often used to hold the results of a curve calibration.

    Curve groups can also be created from a set of existing curves.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static RatesCurveGroup of​(CurveGroupName name,
                                         java.util.Map<Currency,​Curve> discountCurves,
                                         java.util.Map<Index,​Curve> forwardCurves)
        Returns a curve group containing the specified curves.
        Parameters:
        name - the name of the curve group
        discountCurves - the discount curves, keyed by currency
        forwardCurves - the forward curves, keyed by index
        Returns:
        a curve group containing the specified curves
      • ofCurves

        public static RatesCurveGroup ofCurves​(RatesCurveGroupDefinition curveGroupDefinition,
                                               Curve... curves)
        Creates a curve group using a curve group definition and some existing curves.

        If there are curves named in the definition which are not present in the curves the group is built using whatever curves are available.

        If there are multiple curves with the same name in the curves one of them is arbitrarily chosen.

        Multiple curves with the same name are allowed to support the use case where the list contains the same curve multiple times. This means the caller doesn't have to filter the input curves to remove duplicates.

        Parameters:
        curveGroupDefinition - the definition of a curve group
        curves - some curves
        Returns:
        a curve group built from the definition and the list of curves
      • ofCurves

        public static RatesCurveGroup ofCurves​(RatesCurveGroupDefinition curveGroupDefinition,
                                               java.util.Collection<? extends Curve> curves)
        Creates a curve group using a curve group definition and a list of existing curves.

        If there are curves named in the definition which are not present in the curves the group is built using whatever curves are available.

        If there are multiple curves with the same name in the curves one of them is arbitrarily chosen.

        Multiple curves with the same name are allowed to support the use case where the list contains the same curve multiple times. This means the caller doesn't have to filter the input curves to remove duplicates.

        Parameters:
        curveGroupDefinition - the definition of a curve group
        curves - some curves
        Returns:
        a curve group built from the definition and the list of curves
      • findCurve

        public java.util.Optional<Curve> findCurve​(CurveName name)
        Finds the curve with the specified name.

        If the curve cannot be found, empty is returned.

        Specified by:
        findCurve in interface CurveGroup
        Parameters:
        name - the curve name
        Returns:
        the curve, empty if not found
      • findDiscountCurve

        public java.util.Optional<Curve> findDiscountCurve​(Currency currency)
        Finds the discount curve for the currency if there is one in the group.

        If the curve is not found, optional empty is returned.

        Parameters:
        currency - the currency for which a discount curve is required
        Returns:
        the discount curve for the currency if there is one in the group
      • findForwardCurve

        public java.util.Optional<Curve> findForwardCurve​(Index index)
        Finds the forward curve for the index if there is one in the group.

        If the curve is not found, optional empty is returned.

        Parameters:
        index - the index for which a forward curve is required
        Returns:
        the forward curve for the index if there is one in the group
      • stream

        public java.util.stream.Stream<Curve> stream()
        Returns a stream of all curves in the group.
        Specified by:
        stream in interface CurveGroup
        Returns:
        Returns a stream of all curves in the group
      • meta

        public static RatesCurveGroup.Meta meta()
        The meta-bean for RatesCurveGroup.
        Returns:
        the meta-bean, not null
      • builder

        public static RatesCurveGroup.Builder builder()
        Returns a builder used to create an instance of the bean.
        Returns:
        the builder, not null
      • getName

        public CurveGroupName getName()
        Gets the name of the curve group.
        Specified by:
        getName in interface CurveGroup
        Returns:
        the value of the property, not null
      • getDiscountCurves

        public com.google.common.collect.ImmutableMap<Currency,​Curve> getDiscountCurves()
        Gets the discount curves in the group, keyed by currency.
        Returns:
        the value of the property, not null
      • getForwardCurves

        public com.google.common.collect.ImmutableMap<Index,​Curve> getForwardCurves()
        Gets the forward curves in the group, keyed by index.
        Returns:
        the value of the property, not null
      • toBuilder

        public RatesCurveGroup.Builder toBuilder()
        Returns a builder that allows this bean to be mutated.
        Returns:
        the mutable builder, not null
      • 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