Class CurrencyParameterSensitivity
- java.lang.Object
- 
- com.opengamma.strata.market.param.CurrencyParameterSensitivity
 
- 
- All Implemented Interfaces:
- FxConvertible<CurrencyParameterSensitivity>,- Serializable,- org.joda.beans.Bean,- org.joda.beans.ImmutableBean
 
 public final class CurrencyParameterSensitivity extends Object implements FxConvertible<CurrencyParameterSensitivity>, org.joda.beans.ImmutableBean, Serializable Currency-based parameter sensitivity for parameterized market data, such as a curve.Parameter sensitivity is the sensitivity of a value to the parameters of a parameterized market data object that is used to determine the value. Common ParameterizedDataimplementations includeCurveandSurface.The sensitivity is expressed as an array, with one entry for each parameter in the ParameterizedData. The sensitivity represents a monetary value in the specified currency.A single CurrencyParameterSensitivityrepresents the sensitivity to a singleParameterizedDatainstance. However, aParameterizedDatainstance can itself be backed by more than one underlying instance. For example, a curve formed from two underlying curves. Information about the split between these underlying instances can optionally be stored.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classCurrencyParameterSensitivity.BuilderThe bean-builder forCurrencyParameterSensitivity.static classCurrencyParameterSensitivity.MetaThe meta-bean forCurrencyParameterSensitivity.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CurrencyParameterSensitivity.Builderbuilder()Returns a builder used to create an instance of the bean.static CurrencyParameterSensitivitycombine(MarketDataName<?> marketDataName, CurrencyParameterSensitivity... sensitivities)Combines two or more instances to form a single sensitivity instance.intcompareKey(CurrencyParameterSensitivity other)Compares the key of two sensitivity objects, excluding the parameter sensitivity values.CurrencyParameterSensitivityconvertedTo(Currency resultCurrency, FxRateProvider rateProvider)Converts this sensitivity to an equivalent in the specified currency.booleanequals(Object obj)CurrencygetCurrency()Gets the currency of the sensitivity.MarketDataName<?>getMarketDataName()Gets the market data name.intgetParameterCount()Gets the number of parameters.ImmutableList<ParameterMetadata>getParameterMetadata()Gets the list of parameter metadata.ParameterMetadatagetParameterMetadata(int parameterIndex)Gets the parameter metadata at the specified index.Optional<List<ParameterSize>>getParameterSplit()Gets the split of parameters between the underlying parameterized data.DoubleArraygetSensitivity()Gets the parameter sensitivity values.inthashCode()CurrencyParameterSensitivitymapSensitivity(DoubleUnaryOperator operator)Returns an instance with the specified operation applied to the sensitivity values.static CurrencyParameterSensitivity.Metameta()The meta-bean forCurrencyParameterSensitivity.CurrencyParameterSensitivity.MetametaBean()CurrencyParameterSensitivitymultipliedBy(double factor)Returns an instance with the sensitivity values multiplied by the specified factor.static CurrencyParameterSensitivityof(MarketDataName<?> marketDataName, Currency currency, DoubleArray sensitivity)Obtains an instance from the market data name, currency and sensitivity.static CurrencyParameterSensitivityof(MarketDataName<?> marketDataName, Currency currency, Map<? extends ParameterMetadata,Double> sensitivityMetadataMap)Obtains an instance from the market data name, currency and a map of metadata to sensitivity.static CurrencyParameterSensitivityof(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleArray sensitivity)Obtains an instance from the market data name, metadata, currency and sensitivity.static CurrencyParameterSensitivityof(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleArray sensitivity, List<ParameterSize> parameterSplit)Obtains an instance from the market data name, metadata, currency, sensitivity and parameter split.CurrencyParameterSensitivityplus(DoubleArray otherSensitivty)Returns an instance with the specified sensitivity array added to the array in this instance.CurrencyParameterSensitivityplus(CurrencyParameterSensitivity otherSensitivty)Returns an instance with the specified sensitivity array added to the array in this instance.MapStream<ParameterMetadata,Double>sensitivities()Converts this instance to a stream of sensitivity, keyed by the parameter metadata.ImmutableList<CurrencyParameterSensitivity>split()Splits this sensitivity instance.CurrencyParameterSensitivity.BuildertoBuilder()Returns a builder that allows this bean to be mutated.<T> ImmutableMap<T,Double>toSensitivityMap(Class<T> identifierType)Converts this instance to a map of sensitivities, keyed by the identifier.StringtoString()CurrencyAmounttotal()Returns the total of the sensitivity values.UnitParameterSensitivitytoUnitParameterSensitivity()Converts this instance to the equivalent unit sensitivity.CurrencyParameterSensitivitywithSensitivity(DoubleArray sensitivity)Returns an instance with new parameter sensitivity values.
 
- 
- 
- 
Method Detail- 
ofpublic static CurrencyParameterSensitivity of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleArray sensitivity) Obtains an instance from the market data name, metadata, currency and sensitivity.The market data name identifies the ParameterizedDatainstance 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 to
- parameterMetadata- the parameter metadata
- currency- the currency of the sensitivity
- sensitivity- the sensitivity values, one for each parameter
- Returns:
- the sensitivity object
 
 - 
ofpublic static CurrencyParameterSensitivity of(MarketDataName<?> marketDataName, Currency currency, DoubleArray sensitivity) Obtains an instance from the market data name, currency and sensitivity.The market data name identifies the ParameterizedDatainstance that was queried. The parameter metadata will be empty. 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 to
- currency- the currency of the sensitivity
- sensitivity- the sensitivity values, one for each parameter
- Returns:
- the sensitivity object
 
 - 
ofpublic static CurrencyParameterSensitivity of(MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleArray sensitivity, List<ParameterSize> parameterSplit) Obtains an instance from the market data name, metadata, currency, sensitivity and parameter split.The market data name identifies the ParameterizedDatainstance 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.The parameter split allows the sensitivity to represent the split between two or more underlying ParameterizedDatainstances. The sum of the parameters in the split must equal the size of the sensitivity array, and each name must be unique.- Parameters:
- marketDataName- the name of the market data that the sensitivity refers to
- parameterMetadata- the parameter metadata
- currency- the currency of the sensitivity
- sensitivity- the sensitivity values, one for each parameter
- parameterSplit- the split between the underlying- ParameterizedDatainstances
- Returns:
- the sensitivity object
 
 - 
ofpublic static CurrencyParameterSensitivity of(MarketDataName<?> marketDataName, Currency currency, Map<? extends ParameterMetadata,Double> sensitivityMetadataMap) Obtains an instance from the market data name, currency and a map of metadata to sensitivity.The market data name identifies the ParameterizedDatainstance that was queried. The parameter metadata provides information on each parameter. One use of this method is to provide tenor-based sensitivity viaTenorParameterMetadata.- Parameters:
- marketDataName- the name of the market data that the sensitivity refers to
- currency- the currency of the sensitivity
- sensitivityMetadataMap- the map of parameter metadata to sensitivity
- Returns:
- the sensitivity object
 
 - 
combinepublic static CurrencyParameterSensitivity combine(MarketDataName<?> marketDataName, CurrencyParameterSensitivity... sensitivities) Combines two or more instances to form a single sensitivity instance.The result will store information about the separate instances allowing it to be split()later.If a single sensitivity is supplied and refers to the same market data then it will be returned unmodified. Otherwise a new instance will be returned with a single parameter split (the original sensitivity). - Parameters:
- marketDataName- the combined name of the market data that the sensitivity refers to
- sensitivities- the sensitivity instances to combine, two or more
- Returns:
- the combined sensitivity object
 
 - 
getParameterCountpublic int getParameterCount() Gets the number of parameters.This returns the number of parameters in the ParameterizedDatainstance which is the same size as the sensitivity array.- Returns:
- the number of parameters
 
 - 
getParameterMetadatapublic 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
 
 - 
compareKeypublic int compareKey(CurrencyParameterSensitivity 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
 
 - 
convertedTopublic CurrencyParameterSensitivity 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:
- convertedToin interface- FxConvertible<CurrencyParameterSensitivity>
- 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
 
 - 
multipliedBypublic CurrencyParameterSensitivity 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
 
 - 
mapSensitivitypublic CurrencyParameterSensitivity 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
 
 - 
withSensitivitypublic CurrencyParameterSensitivity withSensitivity(DoubleArray 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
 
 - 
pluspublic CurrencyParameterSensitivity plus(DoubleArray otherSensitivty) Returns an instance with the specified sensitivity array added to the array in this instance.The specified array must match the size of the array in this instance. - Parameters:
- otherSensitivty- the other parameter sensitivity
- Returns:
- an instance based on this one, with the other instance added
- Throws:
- IllegalArgumentException- if the market data name, metadata or parameter split differs
 
 - 
pluspublic CurrencyParameterSensitivity plus(CurrencyParameterSensitivity otherSensitivty) Returns an instance with the specified sensitivity array added to the array in this instance.The specified instance must have the same name, metadata, currency and parameter split as this instance. - Parameters:
- otherSensitivty- the other parameter sensitivity
- Returns:
- an instance based on this one, with the other instance added
- Throws:
- IllegalArgumentException- if the market data name, metadata or parameter split differs
 
 - 
splitpublic ImmutableList<CurrencyParameterSensitivity> split() Splits this sensitivity instance.A single sensitivity instance may be based on more than one underlying ParameterizedData, as represented bygetParameterSplit(). Calling this method returns a list where the sensitivity of this instance has been split into multiple instances as per the parameter split definition. In the common case where there is a single underlyingParameterizedData, the list will be of size one containing this instance.- Returns:
- this sensitivity split as per the defined parameter split, ordered as per this instance
 
 - 
totalpublic CurrencyAmount total() Returns the total of the sensitivity values.- Returns:
- the total sensitivity values
 
 - 
sensitivitiespublic MapStream<ParameterMetadata,Double> sensitivities() Converts this instance to a stream of sensitivity, keyed by the parameter metadata.This returns a MapStreamkeyed by the parameter metadata.- Returns:
- a map stream containing the parameter metadata and the sensitivity value
 
 - 
toSensitivityMappublic <T> ImmutableMap<T,Double> toSensitivityMap(Class<T> identifierType) Converts this instance to a map of sensitivities, keyed by the identifier.This returns a Mapkeyed by the identifier of the metadata. For example, this could be used to extract aMap<Tenor, Double>.- Type Parameters:
- T- the type of the identifier
- Parameters:
- identifierType- the type of the parameter metadata identifier
- Returns:
- a map containing the parameter metadata identifier and the sensitivity value
- Throws:
- ClassCastException- if the identifier of the parameter metadata does not match the specified type
 
 - 
toUnitParameterSensitivitypublic UnitParameterSensitivity toUnitParameterSensitivity() Converts this instance to the equivalent unit sensitivity.The result has the same sensitivity values, but no longer records the currency. - Returns:
- an instance based on this one, with the currency removed
 
 - 
metapublic static CurrencyParameterSensitivity.Meta meta() The meta-bean forCurrencyParameterSensitivity.- Returns:
- the meta-bean, not null
 
 - 
builderpublic static CurrencyParameterSensitivity.Builder builder() Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
 
 - 
metaBeanpublic CurrencyParameterSensitivity.Meta metaBean() - Specified by:
- metaBeanin interface- org.joda.beans.Bean
 
 - 
getMarketDataNamepublic 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
 
 - 
getParameterMetadatapublic ImmutableList<ParameterMetadata> getParameterMetadata() Gets the list of parameter metadata.There is one entry for each parameter. - Returns:
- the value of the property, not null
 
 - 
getCurrencypublic Currency getCurrency() Gets the currency of the sensitivity.- Returns:
- the value of the property, not null
 
 - 
getSensitivitypublic DoubleArray getSensitivity() Gets the parameter sensitivity values.There is one sensitivity value for each parameter. - Returns:
- the value of the property, not null
 
 - 
getParameterSplitpublic Optional<List<ParameterSize>> getParameterSplit() Gets the split of parameters between the underlying parameterized data.A single CurrencyParameterSensitivityrepresents the sensitivity to a singleParameterizedDatainstance. However, aParameterizedDatainstance can itself be backed by more than one underlying instance. For example, a curve formed from two underlying curves. If this list is present, it represents how to split this sensitivity between the underlying instances.- Returns:
- the optional value of the property, not null
 
 - 
toBuilderpublic CurrencyParameterSensitivity.Builder toBuilder() Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
 
 
- 
 
-