public final class PointSensitivities extends Object implements FxConvertible<PointSensitivities>, org.joda.beans.ImmutableBean, Serializable
Contains a list of point sensitivity objects, each referring to a specific point on a curve that was queried. The order of the list has no specific meaning, but does allow duplicates.
For example, the point sensitivity for present value on a FRA might contain two entries, one for the Ibor forward curve and one for the discount curve. Each entry identifies the date that the curve was queried and the resulting multiplier.
When creating an instance, consider using MutablePointSensitivities.
One way of viewing this class is as a Map from a specific sensitivity
key to a double sensitivity value. However, instead or being structured
as a Map, the data is structured as a List, with the key and
value in each entry.
| Modifier and Type | Class and Description |
|---|---|
static class |
PointSensitivities.Meta
The meta-bean for
PointSensitivities. |
| Modifier and Type | Method and Description |
|---|---|
PointSensitivities |
combinedWith(PointSensitivities other)
Combines this point sensitivities with another instance.
|
PointSensitivities |
convertedTo(Currency resultCurrency,
FxRateProvider rateProvider) |
static PointSensitivities |
empty()
An empty sensitivity instance.
|
boolean |
equals(Object obj) |
boolean |
equalWithTolerance(PointSensitivities other,
double tolerance)
Checks if this sensitivity equals another within the specified tolerance.
|
ImmutableList<PointSensitivity> |
getSensitivities()
Gets the point sensitivities.
|
int |
hashCode() |
PointSensitivities |
mapSensitivities(DoubleUnaryOperator operator)
Applies an operation to the sensitivities in this instance.
|
static PointSensitivities.Meta |
meta()
The meta-bean for
PointSensitivities. |
PointSensitivities.Meta |
metaBean() |
PointSensitivities |
multipliedBy(double factor)
Multiplies the sensitivities in this instance by the specified factor.
|
PointSensitivities |
normalized()
Normalizes the point sensitivities by sorting and merging.
|
static PointSensitivities |
of(List<? extends PointSensitivity> sensitivities)
Obtains an instance from a list of sensitivity entries.
|
static PointSensitivities |
of(PointSensitivity... sensitivity)
Obtains an instance from an array of sensitivity entries.
|
int |
size()
Gets the number of sensitivity entries.
|
MutablePointSensitivities |
toMutable()
Returns a mutable version of this object.
|
String |
toString() |
public static PointSensitivities empty()
public static PointSensitivities of(PointSensitivity... sensitivity)
sensitivity - the sensitivity entrypublic static PointSensitivities of(List<? extends PointSensitivity> sensitivities)
sensitivities - the list of sensitivity entriespublic int size()
public PointSensitivities combinedWith(PointSensitivities other)
This returns a new sensitivity instance with a combined list of point sensitivities. This instance is immutable and unaffected by this method. The result may contain duplicate point sensitivities.
other - the other point sensitivitiesPointSensitivities based on this one, with the other instance addedpublic PointSensitivities multipliedBy(double factor)
The result will consist of the same entries, but with each sensitivity value multiplied. This instance is immutable and unaffected by this method.
factor - the multiplicative factorPointSensitivities based on this one, with each sensitivity multiplied by the factorpublic PointSensitivities mapSensitivities(DoubleUnaryOperator operator)
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);
operator - the operator to be applied to the sensitivitiesPointSensitivities based on this one, with the operator applied to the sensitivity valuespublic PointSensitivities normalized()
The list of sensitivities is 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.
The intention is that normalization occurs after gathering all the point sensitivities.
This instance is immutable and unaffected by this method.
PointSensitivities based on this one, with the sensitivities normalizedpublic MutablePointSensitivities toMutable()
The result is an instance of the mutable MutablePointSensitivities.
It will contain the same individual sensitivity entries.
public boolean equalWithTolerance(PointSensitivities other, double tolerance)
This returns true if the two instances have the list of PointSensitivity,
where the sensitivity double values are compared within the specified tolerance.
It is expected that this comparator will be used on the normalized version of the sensitivity.
other - the other sensitivitytolerance - the tolerancepublic PointSensitivities convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
convertedTo in interface FxConvertible<PointSensitivities>public static PointSensitivities.Meta meta()
PointSensitivities.public PointSensitivities.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic ImmutableList<PointSensitivity> getSensitivities()
Each entry includes details of the market data query it relates to.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.