## Class CrossGammaParameterSensitivities

• java.lang.Object
• com.opengamma.strata.market.param.CrossGammaParameterSensitivities
• All Implemented Interfaces:
FxConvertible<CrossGammaParameterSensitivities>, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

public final class CrossGammaParameterSensitivities
extends Object
implements FxConvertible<CrossGammaParameterSensitivities>, org.joda.beans.ImmutableBean, Serializable
The second order parameter sensitivity for parameterized market data.

Parameter sensitivity is the sensitivity of a value to the parameters of parameterized market data objects that are used to determine the value. The main application is the parameter sensitivities for curves. Thus ParameterizedData is typically Curve.

The sensitivity is expressed as a single entry of second order sensitivities for piece of parameterized market data. The cross-gamma between different ParameterizedData is not represented. The sensitivity represents a monetary value in the specified currency. The order of the list has no specific meaning.

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

Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  CrossGammaParameterSensitivities.Meta
The meta-bean for CrossGammaParameterSensitivities.
• ### Method Summary

All Methods
Modifier and Type Method Description
CrossGammaParameterSensitivities combinedWith​(CrossGammaParameterSensitivities other)
Combines this parameter sensitivities with another instance.
CrossGammaParameterSensitivities combinedWith​(CrossGammaParameterSensitivity other)
Combines this parameter sensitivities with another instance.
CrossGammaParameterSensitivities convertedTo​(Currency resultCurrency, FxRateProvider rateProvider)
Converts the sensitivities in this instance to an equivalent in the specified currency.
CurrencyParameterSensitivities diagonal()
Returns the diagonal part of the sensitivity values.
static CrossGammaParameterSensitivities empty()
An empty sensitivity instance.
boolean equals​(Object obj)
boolean equalWithTolerance​(CrossGammaParameterSensitivities other, double tolerance)
Checks if this sensitivity equals another within the specified tolerance.
Optional<CrossGammaParameterSensitivity> findSensitivity​(MarketDataName<?> name, Currency currency)
Finds a single sensitivity instance by name and currency.
ImmutableList<CrossGammaParameterSensitivity> getSensitivities()
Gets the parameter sensitivities.
CrossGammaParameterSensitivity getSensitivity​(MarketDataName<?> name, Currency currency)
Gets a single sensitivity instance by name and currency.
CrossGammaParameterSensitivity getSensitivity​(MarketDataName<?> nameFirst, MarketDataName<?> nameSecond, Currency currency)
Gets a single sensitivity instance by names and currency.
int hashCode()
CrossGammaParameterSensitivities mapSensitivities​(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.
static CrossGammaParameterSensitivities.Meta meta()
The meta-bean for CrossGammaParameterSensitivities.
CrossGammaParameterSensitivities.Meta metaBean()
CrossGammaParameterSensitivities multipliedBy​(double factor)
Returns an instance with the sensitivity values multiplied by the specified factor.
static CrossGammaParameterSensitivities of​(CrossGammaParameterSensitivity sensitivity)
Obtains an instance from a single sensitivity entry.
static CrossGammaParameterSensitivities of​(CrossGammaParameterSensitivity... sensitivities)
Obtains an instance from an array of sensitivity entries.
static CrossGammaParameterSensitivities of​(List<? extends CrossGammaParameterSensitivity> sensitivities)
Obtains an instance from a list of sensitivity entries.
int size()
Gets the number of sensitivity entries.
String toString()
MultiCurrencyAmount total()
Returns the total of the sensitivity values.
CurrencyAmount total​(Currency resultCurrency, FxRateProvider rateProvider)
Returns the total of the sensitivity values.
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• ### Methods inherited from interface org.joda.beans.Bean

property, propertyNames
• ### Method Detail

• #### empty

public static CrossGammaParameterSensitivities empty()
An empty sensitivity instance.
Returns:
the empty instance
• #### of

public static CrossGammaParameterSensitivities of​(CrossGammaParameterSensitivity sensitivity)
Obtains an instance from a single sensitivity entry.
Parameters:
sensitivity - the sensitivity entry
Returns:
the sensitivities instance
• #### of

public static CrossGammaParameterSensitivities of​(CrossGammaParameterSensitivity... sensitivities)
Obtains an instance from an array of sensitivity entries.

The order of sensitivities is typically unimportant, however it is retained and exposed in equals(Object).

Parameters:
sensitivities - the sensitivities
Returns:
the sensitivities instance
• #### of

public static CrossGammaParameterSensitivities of​(List<? extends CrossGammaParameterSensitivity> sensitivities)
Obtains an instance from a list of sensitivity entries.

The order of sensitivities is typically unimportant, however it is retained and exposed in equals(Object).

Parameters:
sensitivities - the list of sensitivity entries
Returns:
the sensitivities instance
• #### size

public int size()
Gets the number of sensitivity entries.
Returns:
the size of the internal list of point sensitivities
• #### getSensitivity

public CrossGammaParameterSensitivity getSensitivity​(MarketDataName<?> name,
Currency currency)
Gets a single sensitivity instance by name and currency.
Parameters:
name - the curve name to find
currency - the currency to find
Returns:
the matching sensitivity
Throws:
IllegalArgumentException - if the name and currency do not match an entry
• #### getSensitivity

public CrossGammaParameterSensitivity getSensitivity​(MarketDataName<?> nameFirst,
MarketDataName<?> nameSecond,
Currency currency)
Gets a single sensitivity instance by names and currency.

This returns the sensitivity of the market data (nameFirst) delta to another market data (nameSecond). The result is sensitive to the order of nameFirst and nameSecond.

Parameters:
nameFirst - the name
nameSecond - the name
currency - the currency
Returns:
the matching sensitivity
Throws:
IllegalArgumentException - if the name and currency do not match an entry
• #### findSensitivity

public Optional<CrossGammaParameterSensitivity> findSensitivity​(MarketDataName<?> name,
Currency currency)
Finds a single sensitivity instance by name and currency.

Parameters:
name - the curve name to find
currency - the currency to find
Returns:
the matching sensitivity
• #### combinedWith

public CrossGammaParameterSensitivities combinedWith​(CrossGammaParameterSensitivity other)
Combines this parameter sensitivities with another instance.

This returns a new sensitivity instance with the specified sensitivity added. This instance is immutable and unaffected by this method. The result may contain duplicate parameter sensitivities.

Parameters:
other - the other parameter sensitivity
Returns:
an instance based on this one, with the other instance added
• #### combinedWith

public CrossGammaParameterSensitivities combinedWith​(CrossGammaParameterSensitivities other)
Combines this parameter sensitivities with another instance.

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

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

public CrossGammaParameterSensitivities 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<CrossGammaParameterSensitivities>
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:
RuntimeException - if no FX rate could be found
• #### total

public CurrencyAmount total​(Currency resultCurrency,
FxRateProvider rateProvider)
Returns the total of the sensitivity values.

The result is the total of all values, as converted to the specified currency. Any FX conversion that is required will use rates from the provider.

Parameters:
resultCurrency - the currency of the result
rateProvider - the provider of FX rates
Returns:
the total sensitivity
Throws:
RuntimeException - if no FX rate could be found
• #### total

public MultiCurrencyAmount total()
Returns the total of the sensitivity values.

The result is the total of all values, in whatever currency they are defined.

Returns:
the total sensitivity
• #### diagonal

public CurrencyParameterSensitivities diagonal()
Returns the diagonal part of the sensitivity values.
Returns:
the diagonal part
• #### multipliedBy

public CrossGammaParameterSensitivities multipliedBy​(double factor)
Returns an instance with the sensitivity values multiplied 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.

Parameters:
factor - the multiplicative factor
Returns:
an instance based on this one, with each sensitivity multiplied by the factor
• #### mapSensitivities

public CrossGammaParameterSensitivities mapSensitivities​(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.

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);

Parameters:
operator - the operator to be applied to the sensitivities
Returns:
an instance based on this one, with the operator applied to the sensitivity values
• #### equalWithTolerance

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

This returns true if the two instances have the same keys, with arrays of the same length, where the double values are equal within the specified tolerance.

Parameters:
other - the other sensitivity
tolerance - the tolerance
Returns:
true if equal up to the tolerance
• #### meta

public static CrossGammaParameterSensitivities.Meta meta()
The meta-bean for CrossGammaParameterSensitivities.
Returns:
the meta-bean, not null
• #### metaBean

public CrossGammaParameterSensitivities.Meta metaBean()
Specified by:
metaBean in interface org.joda.beans.Bean
• #### getSensitivities

public ImmutableList<CrossGammaParameterSensitivity> getSensitivities()
Gets the parameter sensitivities.

Each entry includes details of the ParameterizedData it relates to.

Returns:
the value of the property, not null
• #### equals

public boolean equals​(Object obj)
Overrides:
equals in class Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class Object
• #### toString

public String toString()
Overrides:
toString in class Object