Interface PointSensitivityBuilder
-
- All Known Implementing Classes:
BondFutureOptionSensitivity
,BondYieldSensitivity
,CreditCurveZeroRateSensitivity
,FxForwardSensitivity
,FxIndexSensitivity
,FxOptionSensitivity
,IborCapletFloorletSabrSensitivity
,IborCapletFloorletSensitivity
,IborFutureOptionSensitivity
,IborRateSensitivity
,InflationRateSensitivity
,IssuerCurveZeroRateSensitivity
,MutablePointSensitivities
,OvernightRateSensitivity
,RepoCurveZeroRateSensitivity
,SwaptionSabrSensitivity
,SwaptionSensitivity
,ZeroRateSensitivity
public interface PointSensitivityBuilder
Builder used to create point sensitivities.The sensitivity to a single point on a curve is known as point sensitivity. This builder allows the individual sensitivities to be built into a combined result.
Implementations may be mutable, however the methods are intended to be used in an immutable style. Once a method is called, code should refer and use only the result, not the original instance.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default PointSensitivities
build()
Builds the resulting point sensitivity.MutablePointSensitivities
buildInto(MutablePointSensitivities combination)
Builds the point sensitivity, adding to the specified mutable instance.PointSensitivityBuilder
cloned()
Clones the point sensitivity builder.default PointSensitivityBuilder
combinedWith(PointSensitivityBuilder other)
Combines this sensitivity with another instance.PointSensitivityBuilder
mapSensitivity(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivities in this builder.default PointSensitivityBuilder
multipliedBy(double factor)
Multiplies the sensitivities in this builder by the specified factor.static PointSensitivityBuilder
none()
Returns a builder representing no sensitivity.PointSensitivityBuilder
normalize()
Normalizes the point sensitivities by sorting and merging.static PointSensitivityBuilder
of(PointSensitivity... sensitivities)
Returns a builder with the specified sensitivities.static PointSensitivityBuilder
of(List<? extends PointSensitivity> sensitivities)
Returns a builder with the specified sensitivities.PointSensitivityBuilder
withCurrency(Currency currency)
Returns an instance with the specified currency applied to the sensitivities in this builder.
-
-
-
Method Detail
-
none
static PointSensitivityBuilder none()
Returns a builder representing no sensitivity.This would be used if the rate was fixed, or if the rate was obtained from a historic time-series rather than a forward curve.
- Returns:
- the empty builder
-
of
static PointSensitivityBuilder of(PointSensitivity... sensitivities)
Returns a builder with the specified sensitivities.- Parameters:
sensitivities
- the list of sensitivities, which is copied- Returns:
- the builder
-
of
static PointSensitivityBuilder of(List<? extends PointSensitivity> sensitivities)
Returns a builder with the specified sensitivities.- Parameters:
sensitivities
- the list of sensitivities, which is copied- Returns:
- the builder
-
withCurrency
PointSensitivityBuilder withCurrency(Currency currency)
Returns an instance with the specified currency applied to the sensitivities in this builder.The result will consists of the same points, but with the sensitivity currency assigned.
Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used.
- Parameters:
currency
- the currency to be applied to the sensitivities- Returns:
- the resulting builder, replacing this builder
-
multipliedBy
default PointSensitivityBuilder multipliedBy(double factor)
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.
- Parameters:
factor
- the multiplicative factor- Returns:
- the resulting builder, replacing this builder
-
mapSensitivity
PointSensitivityBuilder mapSensitivity(DoubleUnaryOperator operator)
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.
- Parameters:
operator
- the operator to be applied to the sensitivities- Returns:
- the resulting builder, replacing this builder
-
normalize
PointSensitivityBuilder normalize()
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.
- Returns:
- the resulting builder, replacing this builder
-
combinedWith
default PointSensitivityBuilder combinedWith(PointSensitivityBuilder other)
Combines this sensitivity with another instance.This returns an instance with a combined list of point sensitivities.
Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used.
- Parameters:
other
- the other sensitivity builder- Returns:
- the combined builder, replacing this builder and the specified builder
-
buildInto
MutablePointSensitivities buildInto(MutablePointSensitivities combination)
Builds the point sensitivity, adding to the specified mutable instance.- Parameters:
combination
- the combination object to add to- Returns:
- the specified mutable point sensitivities instance is returned, for method chaining
-
build
default PointSensitivities build()
Builds the resulting point sensitivity.This returns a
PointSensitivities
instance.Builders may be mutable. Once this method is called, this instance must not be used.
- Returns:
- the built combined sensitivity
-
cloned
PointSensitivityBuilder cloned()
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.
- Returns:
- the built combined sensitivity
-
-