Class FxForwardSensitivity

    • Method Detail

      • of

        public static FxForwardSensitivity of​(CurrencyPair currencyPair,
                                              Currency referenceCurrency,
                                              LocalDate referenceDate,
                                              double sensitivity)
        Obtains an instance from currency pair, reference currency, reference date and sensitivity value.

        The sensitivity currency is defaulted to be a currency of the currency pair that is not the reference currency.

        Parameters:
        currencyPair - the currency pair
        referenceCurrency - the reference currency
        referenceDate - the reference date
        sensitivity - the value of the sensitivity
        Returns:
        the point sensitivity object
      • of

        public static FxForwardSensitivity of​(CurrencyPair currencyPair,
                                              Currency referenceCurrency,
                                              LocalDate referenceDate,
                                              Currency sensitivityCurrency,
                                              double sensitivity)
        Obtains an instance from currency pair, reference currency, reference date sensitivity currency and sensitivity value.
        Parameters:
        currencyPair - the currency pair
        referenceCurrency - the reference currency
        referenceDate - the reference date
        sensitivityCurrency - the currency of the sensitivity
        sensitivity - the value of the sensitivity
        Returns:
        the point sensitivity object
      • getReferenceCounterCurrency

        public Currency getReferenceCounterCurrency()
        Gets the currency counter to the reference currency.

        The currency pair contains two currencies. One is the reference currency. This method returns the other.

        Returns:
        the counter currency
      • withSensitivity

        public FxForwardSensitivity withSensitivity​(double sensitivity)
        Description copied from interface: PointSensitivity
        Returns an instance with the new point sensitivity value.
        Specified by:
        withSensitivity in interface PointSensitivity
        Parameters:
        sensitivity - the new sensitivity
        Returns:
        an instance based on this sensitivity with the specified sensitivity
      • compareKey

        public int compareKey​(PointSensitivity other)
        Description copied from interface: PointSensitivity
        Compares the key of two sensitivities, excluding the point sensitivity value.

        If the other point sensitivity is of a different type, the comparison is based solely on the simple class name. If the point sensitivity is of the same type, the comparison must check the key, then the currency, then the date, then any other state.

        The comparison by simple class name ensures that all instances of the same type are ordered together.

        Specified by:
        compareKey in interface PointSensitivity
        Parameters:
        other - the other sensitivity
        Returns:
        positive if greater, zero if equal, negative if less
      • convertedTo

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

        The result 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<PointSensitivity>
        Specified by:
        convertedTo in interface PointSensitivity
        Parameters:
        resultCurrency - the currency of the result
        rateProvider - the provider of FX rates
        Returns:
        the converted instance, which should be expressed in the specified currency
      • multipliedBy

        public FxForwardSensitivity multipliedBy​(double factor)
        Description copied from interface: PointSensitivityBuilder
        Multiplies the sensitivities in this builder by the specified factor.

        The result will consist of the same points, but with each sensitivity multiplied.

        Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used.

        Specified by:
        multipliedBy in interface PointSensitivityBuilder
        Parameters:
        factor - the multiplicative factor
        Returns:
        the resulting builder, replacing this builder
      • mapSensitivity

        public FxForwardSensitivity mapSensitivity​(DoubleUnaryOperator operator)
        Description copied from interface: PointSensitivityBuilder
        Returns an instance with the specified operation applied to the sensitivities in this builder.

        The result will consist of the same points, but with the operator applied to each sensitivity.

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

           inverse = base.mapSensitivities(value -> 1 / value);
         

        Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used.

        Specified by:
        mapSensitivity in interface PointSensitivityBuilder
        Parameters:
        operator - the operator to be applied to the sensitivities
        Returns:
        the resulting builder, replacing this builder
      • normalize

        public FxForwardSensitivity normalize()
        Description copied from interface: PointSensitivityBuilder
        Normalizes the point sensitivities by sorting and merging.

        The sensitivities in the builder are 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.

        Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used.

        Specified by:
        normalize in interface PointSensitivityBuilder
        Returns:
        the resulting builder, replacing this builder
      • cloned

        public FxForwardSensitivity cloned()
        Description copied from interface: PointSensitivityBuilder
        Clones the point sensitivity builder.

        This returns a PointSensitivityBuilder instance that is independent from the original. Immutable implementations may return themselves.

        Builders may be mutable. Using this method allows a copy of the original to be obtained, so both the original and the clone can be used.

        Specified by:
        cloned in interface PointSensitivityBuilder
        Returns:
        the built combined sensitivity
      • meta

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

        public CurrencyPair getCurrencyPair()
        Gets the currency pair for which the sensitivity is computed.
        Returns:
        the value of the property, not null
      • getReferenceCurrency

        public Currency getReferenceCurrency()
        Gets the reference currency.

        This is the base currency of the FX conversion that occurs using the currency pair. The reference currency must be one of the two currencies of the currency pair.

        Returns:
        the value of the property, not null
      • getReferenceDate

        public LocalDate getReferenceDate()
        Gets the date to query the rate for.
        Returns:
        the value of the property, not null
      • getCurrency

        public Currency getCurrency()
        Gets the currency of the sensitivity.
        Specified by:
        getCurrency in interface PointSensitivity
        Returns:
        the value of the property, not null
      • getSensitivity

        public double getSensitivity()
        Gets the value of the sensitivity. This is the amount that is converted from the base currency to the counter currency.
        Specified by:
        getSensitivity in interface PointSensitivity
        Returns:
        the value of the property
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object