Class CurveSensitivities

    • Method Detail

      • empty

        public static CurveSensitivities empty()
        Obtains an empty instance.
        Returns:
        the empty sensitivities instance
      • builder

        public static CurveSensitivitiesBuilder builder​(PortfolioItemInfo info)
        Returns a builder that can be used to create an instance of CurveSensitivities.

        The builder takes into account the parameter metadata when creating the sensitivity map. As such, the parameter metadata added to the builder must not be empty.

        Parameters:
        info - the additional information
        Returns:
        the builder
      • getTypedSensitivity

        public CurrencyParameterSensitivities getTypedSensitivity​(CurveSensitivitiesType type)
        Gets a sensitivity instance by type, throwing an exception if not found.
        Parameters:
        type - the type to get
        Returns:
        the sensitivity
        Throws:
        java.lang.IllegalArgumentException - if the type is not found
      • findTypedSensitivity

        public java.util.Optional<CurrencyParameterSensitivities> findTypedSensitivity​(CurveSensitivitiesType type)
        Finds a sensitivity instance by type, returning empty if not found.
        Parameters:
        type - the type to find
        Returns:
        the sensitivity, empty if not found
      • mergedWith

        public CurveSensitivities mergedWith​(CurveSensitivities other)
        Combines this set of sensitivities with another set.

        This returns a new curve sensitivities with a combined map of typed sensitivities. Any sensitivities of the same type will be combined as though using CurrencyParameterSensitivities.mergedWith(CurrencyParameterSensitivities). The identifier and attributes of this instance will take precedence.

        Parameters:
        other - the other parameter sensitivities
        Returns:
        an instance based on this one, with the other instance added
      • withMarketDataNames

        public CurveSensitivities withMarketDataNames​(java.util.function.Function<MarketDataName<?>,​MarketDataName<?>> nameFn)
        Checks and adjusts the market data names.

        The supplied function is invoked for each market data name in this sensitivities. A typical use case would be to convert index names to curve names valid for an underlying system.

        Parameters:
        nameFn - the function for checking and adjusting the name
        Returns:
        the adjusted sensitivity
        Throws:
        java.lang.RuntimeException - if the function throws an exception
      • withParameterMetadatas

        public CurveSensitivities withParameterMetadatas​(java.util.function.UnaryOperator<ParameterMetadata> mdFn)
        Checks and adjusts the parameter metadata.

        The supplied function is invoked for each parameter metadata in this sensitivities. If the function returns the same metadata for two different inputs, the sensitivity value will be summed. A typical use case would be to normalize parameter metadata tenors to be valid for an underlying system.

        Parameters:
        mdFn - the function for checking and adjusting the metadata
        Returns:
        the adjusted sensitivity
        Throws:
        java.lang.RuntimeException - if the function throws an exception
      • convertedTo

        public CurveSensitivities convertedTo​(Currency resultCurrency,
                                              FxRateProvider rateProvider)
        Converts the sensitivities in this instance to an equivalent in the specified currency.

        Any FX conversion that is required will use rates from the provider.

        Specified by:
        convertedTo in interface FxConvertible<CurveSensitivities>
        Parameters:
        resultCurrency - the currency of the result
        rateProvider - the provider of FX rates
        Returns:
        the sensitivity object expressed in terms of the result currency
        Throws:
        java.lang.RuntimeException - if no FX rate could be found
      • summarize

        public PortfolioItemSummary summarize()
        Description copied from interface: PortfolioItem
        Summarizes the portfolio item.

        This provides a summary, including a human readable description.

        Specified by:
        summarize in interface PortfolioItem
        Returns:
        the summary of the item
      • meta

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

        public PortfolioItemInfo getInfo()
        Gets the additional information.

        This allows additional information to be attached to the sensitivities.

        Specified by:
        getInfo in interface PortfolioItem
        Returns:
        the value of the property, not null
      • getTypedSensitivities

        public com.google.common.collect.ImmutableMap<CurveSensitivitiesType,​CurrencyParameterSensitivities> getTypedSensitivities()
        Gets the sensitivities, keyed by type.

        The map allows sensitivity to different types to be expressed. For example, there might be both delta and gamma sensitivity.

        Returns:
        the value of the property, 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