Class PointSensitivities

  • All Implemented Interfaces:
    FxConvertible<PointSensitivities>,, Bean, ImmutableBean

    public final class PointSensitivities
    extends java.lang.Object
    implements FxConvertible<PointSensitivities>, ImmutableBean,
    A collection of point sensitivities.

    Contains a list of point sensitivity objects, each referring to a specific point on a curve that was queried. The order of the list has no specific meaning, but does allow duplicates.

    For example, the point sensitivity for present value on a FRA might contain two entries, one for the Ibor forward curve and one for the discount curve. Each entry identifies the date that the curve was queried and the resulting multiplier.

    When creating an instance, consider using MutablePointSensitivities.

    One way of viewing this class is as a Map from a specific sensitivity key to a double sensitivity value. However, instead or being structured as a Map, the data is structured as a List, with the key and value in each entry.

    See Also:
    Serialized Form
    • Method Detail

      • empty

        public static PointSensitivities empty()
        An empty sensitivity instance.
        the empty instance
      • of

        public static PointSensitivities of​(PointSensitivity... sensitivity)
        Obtains an instance from an array of sensitivity entries.
        sensitivity - the sensitivity entry
        the sensitivities instance
      • of

        public static PointSensitivities of​(java.util.List<? extends PointSensitivity> sensitivities)
        Obtains an instance from a list of sensitivity entries.
        sensitivities - the list of sensitivity entries
        the sensitivities instance
      • size

        public int size()
        Gets the number of sensitivity entries.
        the size of the internal list of point sensitivities
      • combinedWith

        public PointSensitivities combinedWith​(PointSensitivities other)
        Combines this point sensitivities with another instance.

        This returns a new sensitivity instance with a combined list of point sensitivities. This instance is immutable and unaffected by this method. The result may contain duplicate point sensitivities.

        other - the other point sensitivities
        a PointSensitivities based on this one, with the other instance added
      • multipliedBy

        public PointSensitivities multipliedBy​(double factor)
        Multiplies the sensitivities in this instance by the specified factor.

        The result will consist of the same entries, but with each sensitivity value multiplied. This instance is immutable and unaffected by this method.

        factor - the multiplicative factor
        a PointSensitivities based on this one, with each sensitivity multiplied by the factor
      • mapSensitivities

        public PointSensitivities mapSensitivities​(java.util.function.DoubleUnaryOperator operator)
        Applies an operation to the sensitivities in this instance.

        The result will consist of the same entries, but with the operator applied to each sensitivity value. This instance is immutable and unaffected by this method.

        This is used to apply a mathematical operation to the sensitivity values. For example, the operator could multiply the sensitivities by a constant, or take the inverse.

           inverse = base.mapSensitivities(value -> 1 / value);
        operator - the operator to be applied to the sensitivities
        a PointSensitivities based on this one, with the operator applied to the sensitivity values
      • normalized

        public PointSensitivities normalized()
        Normalizes the point sensitivities by sorting and merging.

        The list of sensitivities is sorted and then merged. Any two entries that represent the same curve query are merged. For example, if there are two point sensitivities that were created based on the same curve, currency and fixing date, then the entries are combined, summing the sensitivity value.

        The intention is that normalization occurs after gathering all the point sensitivities.

        This instance is immutable and unaffected by this method.

        a PointSensitivities based on this one, with the sensitivities normalized
      • toMutable

        public MutablePointSensitivities toMutable()
        Returns a mutable version of this object.

        The result is an instance of the mutable MutablePointSensitivities. It will contain the same individual sensitivity entries.

        the mutable sensitivity instance, not null
      • equalWithTolerance

        public boolean equalWithTolerance​(PointSensitivities other,
                                          double tolerance)
        Checks if this sensitivity equals another within the specified tolerance.

        This returns true if the two instances have the list of PointSensitivity, where the sensitivity double values are compared within the specified tolerance. It is expected that this comparator will be used on the normalized version of the sensitivity.

        other - the other sensitivity
        tolerance - the tolerance
        true if equal up to the tolerance
      • convertedTo

        public PointSensitivities convertedTo​(Currency resultCurrency,
                                              FxRateProvider rateProvider)
        Description copied from interface: FxConvertible
        Converts this instance to an equivalent amount in the specified currency.

        The result, which may be of a different type, will be expressed in terms of the given currency. Any FX conversion that is required will use rates from the provider.

        Specified by:
        convertedTo in interface FxConvertible<PointSensitivities>
        resultCurrency - the currency of the result
        rateProvider - the provider of FX rates
        the converted instance, which should be expressed in the specified currency
      • meta

        public static PointSensitivities.Meta meta()
        The meta-bean for PointSensitivities.
        the meta-bean, not null
      • getSensitivities

        public<PointSensitivity> getSensitivities()
        Gets the point sensitivities.

        Each entry includes details of the market data query it relates to.

        the value of the property, not null
      • equals

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

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

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