Class CrossGammaParameterSensitivity
- java.lang.Object
-
- com.opengamma.strata.market.param.CrossGammaParameterSensitivity
-
- All Implemented Interfaces:
FxConvertible<CrossGammaParameterSensitivity>
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class CrossGammaParameterSensitivity extends Object implements FxConvertible<CrossGammaParameterSensitivity>, 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 a parameterized market data object that is used to determine the value. The main application of this class is the parameter sensitivities for curves. Thus
ParameterizedData
is typicallyCurve
.The sensitivity is expressed as a matrix. The
(i,j)
component is the sensitivity of thei
-th component of theparameterMetadata
delta to thej
-th parameter inorder
.The sensitivity represents a monetary value in the specified currency.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CrossGammaParameterSensitivity.Meta
The meta-bean forCrossGammaParameterSensitivity
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareKey(CrossGammaParameterSensitivity other)
Compares the key of two sensitivity objects, excluding the parameter sensitivity values.CrossGammaParameterSensitivity
convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Converts this sensitivity to an equivalent in the specified currency.CurrencyParameterSensitivity
diagonal()
Returns the diagonal part of the sensitivity asCurrencyParameterSensitivity
.boolean
equals(Object obj)
Currency
getCurrency()
Gets the currency of the sensitivity.MarketDataName<?>
getMarketDataName()
Gets the market data name.ImmutableList<Pair<MarketDataName<?>,List<? extends ParameterMetadata>>>
getOrder()
Gets the sensitivity order.int
getParameterCount()
Gets the number of parameters.ImmutableList<ParameterMetadata>
getParameterMetadata()
Gets the list of parameter metadata.ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the parameter metadata at the specified index.DoubleMatrix
getSensitivity()
Gets the parameter sensitivity values.CrossGammaParameterSensitivity
getSensitivity(MarketDataName<?> name)
Returns the sensitivity to the market data specified byname
.int
hashCode()
CrossGammaParameterSensitivity
mapSensitivity(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.static CrossGammaParameterSensitivity.Meta
meta()
The meta-bean forCrossGammaParameterSensitivity
.CrossGammaParameterSensitivity.Meta
metaBean()
CrossGammaParameterSensitivity
multipliedBy(double factor)
Returns an instance with the sensitivity values multiplied by the specified factor.static CrossGammaParameterSensitivity
of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data name, metadata, currency and sensitivity.static CrossGammaParameterSensitivity
of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, MarketDataName<?> marketDataNameOther, List<? extends ParameterMetadata> parameterMetadataOther, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data names, metadatas, currency and sensitivity.static CrossGammaParameterSensitivity
of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, List<Pair<MarketDataName<?>,List<? extends ParameterMetadata>>> order, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data names, metadatas, currency and sensitivity.String
toString()
CurrencyAmount
total()
Returns the total of the sensitivity values.CrossGammaParameterSensitivity
withSensitivity(DoubleMatrix sensitivity)
Returns an instance with new parameter sensitivity values.
-
-
-
Method Detail
-
of
public static CrossGammaParameterSensitivity of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data name, metadata, currency and sensitivity.This creates a sensitivity instance which stores the second order sensitivity values to a single market data, i.e., the block diagonal part of the full second order sensitivity matrix.
The market data name identifies the
ParameterizedData
instance that was queried. The parameter metadata provides information on each parameter. The size of the parameter metadata list must match the size of the sensitivity array.- Parameters:
marketDataName
- the name of the market data that the sensitivity refers toparameterMetadata
- the parameter metadatacurrency
- the currency of the sensitivitysensitivity
- the sensitivity values, one for each parameter- Returns:
- the sensitivity object
-
of
public static CrossGammaParameterSensitivity of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, MarketDataName<?> marketDataNameOther, List<? extends ParameterMetadata> parameterMetadataOther, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data names, metadatas, currency and sensitivity.This creates a sensitivity instance which stores the second order sensitivity values: the delta of a market data to another market data. The first market data and the second market data can be the same.
The market data name identifies the
ParameterizedData
instance that was queried. The parameter metadata provides information on each parameter.- Parameters:
marketDataName
- the name of the first market data that the sensitivity refers toparameterMetadata
- the first parameter metadatamarketDataNameOther
- the name of the second market data that the sensitivity refers toparameterMetadataOther
- the second parameter metadatacurrency
- the currency of the sensitivitysensitivity
- the sensitivity values, one for each parameter- Returns:
- the sensitivity object
-
of
public static CrossGammaParameterSensitivity of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, List<Pair<MarketDataName<?>,List<? extends ParameterMetadata>>> order, Currency currency, DoubleMatrix sensitivity)
Obtains an instance from the market data names, metadatas, currency and sensitivity.This creates a sensitivity instance which stores the second order sensitivity values: the delta of a market data to a set of other market data. The market data set is represented in terms of
List<Pair<MarketDataName<?>, List<? extends ParameterMetadata>>>
. which defines the order of the sensitivity values.The market data name identifies the
ParameterizedData
instance that was queried. The parameter metadata provides information on each parameter.- Parameters:
marketDataName
- the name of the market data that the sensitivity refers toparameterMetadata
- the parameter metadataorder
- the ordercurrency
- the currency of the sensitivitysensitivity
- the sensitivity values, one for each parameter- Returns:
- the sensitivity object
-
getParameterCount
public int getParameterCount()
Gets the number of parameters.This returns the number of parameters in the
ParameterizedData
instance which is the same size as the sensitivity array.- Returns:
- the number of parameters
-
getParameterMetadata
public ParameterMetadata getParameterMetadata(int parameterIndex)
Gets the parameter metadata at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
- Throws:
IndexOutOfBoundsException
- if the index is invalid
-
compareKey
public int compareKey(CrossGammaParameterSensitivity other)
Compares the key of two sensitivity objects, excluding the parameter sensitivity values.- Parameters:
other
- the other sensitivity object- Returns:
- positive if greater, zero if equal, negative if less
-
convertedTo
public CrossGammaParameterSensitivity convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Converts this sensitivity to an equivalent in the specified currency.Any FX conversion that is required will use rates from the provider.
- Specified by:
convertedTo
in interfaceFxConvertible<CrossGammaParameterSensitivity>
- Parameters:
resultCurrency
- the currency of the resultrateProvider
- 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
-
multipliedBy
public CrossGammaParameterSensitivity multipliedBy(double factor)
Returns an instance with the sensitivity values multiplied by the specified factor.Each value in the sensitivity array will be multiplied by the factor.
- Parameters:
factor
- the multiplicative factor- Returns:
- an instance based on this one, with each sensitivity multiplied by the factor
-
mapSensitivity
public CrossGammaParameterSensitivity mapSensitivity(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.Each value in the sensitivity array will be operated on. For example, the operator could multiply the sensitivities by a constant, or take the inverse.
inverse = base.mapSensitivity(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
-
withSensitivity
public CrossGammaParameterSensitivity withSensitivity(DoubleMatrix sensitivity)
Returns an instance with new parameter sensitivity values.- Parameters:
sensitivity
- the new sensitivity values- Returns:
- an instance based on this one, with the specified sensitivity values
-
total
public CurrencyAmount total()
Returns the total of the sensitivity values.- Returns:
- the total sensitivity values
-
diagonal
public CurrencyParameterSensitivity diagonal()
Returns the diagonal part of the sensitivity asCurrencyParameterSensitivity
.- Returns:
- the diagonal part
-
getSensitivity
public CrossGammaParameterSensitivity getSensitivity(MarketDataName<?> name)
Returns the sensitivity to the market data specified byname
.This returns a sensitivity instance which stores the sensitivity of the
marketDataName
delta to another market data ofname
.- Parameters:
name
- the name- Returns:
- the sensitivity
- Throws:
IllegalArgumentException
- if the name does not match an entry
-
meta
public static CrossGammaParameterSensitivity.Meta meta()
The meta-bean forCrossGammaParameterSensitivity
.- Returns:
- the meta-bean, not null
-
metaBean
public CrossGammaParameterSensitivity.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getMarketDataName
public MarketDataName<?> getMarketDataName()
Gets the market data name.This name is used in the market data system to identify the data that the sensitivities refer to.
- Returns:
- the value of the property, not null
-
getParameterMetadata
public ImmutableList<ParameterMetadata> getParameterMetadata()
Gets the list of parameter metadata.There is one entry for each parameter.
- Returns:
- the value of the property, not null
-
getOrder
public ImmutableList<Pair<MarketDataName<?>,List<? extends ParameterMetadata>>> getOrder()
Gets the sensitivity order.This defines the order of sensitivity values, which can be used as a key to interpret
sensitivity
.- Returns:
- the value of the property, not null
-
getCurrency
public Currency getCurrency()
Gets the currency of the sensitivity.- Returns:
- the value of the property, not null
-
getSensitivity
public DoubleMatrix getSensitivity()
Gets the parameter sensitivity values.The curve delta sensitivities to parameterized market data. This is a
n x m
matrix, wheren
must agree with the size ofparameterMetadata
andm
must be the sum of parameter count inorder
.- Returns:
- the value of the property, not null
-
-