Class OvernightRateSensitivity
- java.lang.Object
-
- com.opengamma.strata.pricer.rate.OvernightRateSensitivity
-
- All Implemented Interfaces:
FxConvertible<PointSensitivity>
,PointSensitivity
,PointSensitivityBuilder
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class OvernightRateSensitivity extends Object implements PointSensitivity, PointSensitivityBuilder, org.joda.beans.ImmutableBean, Serializable
Point sensitivity to a rate from an Overnight index curve.Holds the sensitivity to the
OvernightIndex
curve for a fixing period.This class handles the common case where the rate for a period is approximated instead of computing the individual rate for each date in the period by storing the end date of the fixing period.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OvernightRateSensitivity.Meta
The meta-bean forOvernightRateSensitivity
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutablePointSensitivities
buildInto(MutablePointSensitivities combination)
Builds the point sensitivity, adding to the specified mutable instance.OvernightRateSensitivity
cloned()
Clones the point sensitivity builder.int
compareKey(PointSensitivity other)
Compares the key of two sensitivities, excluding the point sensitivity value.OvernightRateSensitivity
convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Converts this instance to an equivalent amount in the specified currency.boolean
equals(Object obj)
Currency
getCurrency()
Gets the currency of the sensitivity.LocalDate
getEndDate()
Gets the end date of the period.OvernightIndex
getIndex()
Gets the Overnight index that the sensitivity refers to.OvernightIndexObservation
getObservation()
Gets the Overnight rate observation.double
getSensitivity()
Gets the value of the sensitivity.int
hashCode()
OvernightRateSensitivity
mapSensitivity(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivities in this builder.static OvernightRateSensitivity.Meta
meta()
The meta-bean forOvernightRateSensitivity
.OvernightRateSensitivity.Meta
metaBean()
OvernightRateSensitivity
multipliedBy(double factor)
Multiplies the sensitivities in this builder by the specified factor.OvernightRateSensitivity
normalize()
Normalizes the point sensitivities by sorting and merging.static OvernightRateSensitivity
of(OvernightIndexObservation observation, double sensitivity)
Obtains an instance from the observation and sensitivity value.static OvernightRateSensitivity
of(OvernightIndexObservation observation, Currency sensitivityCurrency, double sensitivity)
Obtains an instance from the observation and sensitivity value, specifying the currency of the value.static OvernightRateSensitivity
ofPeriod(OvernightIndexObservation observation, LocalDate endDate, double sensitivity)
Obtains an instance for a period observation of the index from the observation and sensitivity value.static OvernightRateSensitivity
ofPeriod(OvernightIndexObservation observation, LocalDate endDate, Currency sensitivityCurrency, double sensitivity)
Obtains an instance for a period observation of the index from the observation and sensitivity value, specifying the currency of the value.String
toString()
OvernightRateSensitivity
withCurrency(Currency currency)
Returns an instance with the specified sensitivity currency set.OvernightRateSensitivity
withSensitivity(double sensitivity)
Returns an instance with the new point sensitivity value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.market.sensitivity.PointSensitivityBuilder
build, combinedWith
-
-
-
-
Method Detail
-
of
public static OvernightRateSensitivity of(OvernightIndexObservation observation, double sensitivity)
Obtains an instance from the observation and sensitivity value.The currency is defaulted from the index. The end date will be the maturity date of the observation.
- Parameters:
observation
- the rate observation, including the fixing datesensitivity
- the value of the sensitivity- Returns:
- the point sensitivity object
-
of
public static OvernightRateSensitivity of(OvernightIndexObservation observation, Currency sensitivityCurrency, double sensitivity)
Obtains an instance from the observation and sensitivity value, specifying the currency of the value.The end date will be the maturity date of the observation.
- Parameters:
observation
- the rate observation, including the fixing datesensitivityCurrency
- the currency of the sensitivitysensitivity
- the value of the sensitivity- Returns:
- the point sensitivity object
-
ofPeriod
public static OvernightRateSensitivity ofPeriod(OvernightIndexObservation observation, LocalDate endDate, double sensitivity)
Obtains an instance for a period observation of the index from the observation and sensitivity value.The currency is defaulted from the index.
- Parameters:
observation
- the rate observation, including the fixing dateendDate
- the end date of the periodsensitivity
- the value of the sensitivity- Returns:
- the point sensitivity object
-
ofPeriod
public static OvernightRateSensitivity ofPeriod(OvernightIndexObservation observation, LocalDate endDate, Currency sensitivityCurrency, double sensitivity)
Obtains an instance for a period observation of the index from the observation and sensitivity value, specifying the currency of the value.- Parameters:
observation
- the rate observation, including the fixing dateendDate
- the end date of the periodsensitivityCurrency
- the currency of the sensitivitysensitivity
- the value of the sensitivity- Returns:
- the point sensitivity object
-
getIndex
public OvernightIndex getIndex()
Gets the Overnight index that the sensitivity refers to.- Returns:
- the Overnight index
-
withCurrency
public OvernightRateSensitivity withCurrency(Currency currency)
Description copied from interface:PointSensitivity
Returns an instance with the specified sensitivity currency set.The result will consists of the same points, but with the sensitivity currency altered.
- Specified by:
withCurrency
in interfacePointSensitivity
- Specified by:
withCurrency
in interfacePointSensitivityBuilder
- Parameters:
currency
- the new currency- Returns:
- an instance based on this sensitivity with the specified currency
-
withSensitivity
public OvernightRateSensitivity withSensitivity(double sensitivity)
Description copied from interface:PointSensitivity
Returns an instance with the new point sensitivity value.- Specified by:
withSensitivity
in interfacePointSensitivity
- Parameters:
sensitivity
- the new sensitivity- Returns:
- an instance based on this sensitivity with the specified sensitivity
-
compareKey
public int compareKey(PointSensitivity other)
Description copied from interface:PointSensitivity
Compares the key of two sensitivities, excluding the point sensitivity value.If the other point sensitivity is of a different type, the comparison is based solely on the simple class name. If the point sensitivity is of the same type, the comparison must check the key, then the currency, then the date, then any other state.
The comparison by simple class name ensures that all instances of the same type are ordered together.
- Specified by:
compareKey
in interfacePointSensitivity
- Parameters:
other
- the other sensitivity- Returns:
- positive if greater, zero if equal, negative if less
-
convertedTo
public OvernightRateSensitivity convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Description copied from interface:PointSensitivity
Converts this instance to an equivalent amount in the specified currency.The result will be expressed in terms of the given currency. Any FX conversion that is required will use rates from the provider.
- Specified by:
convertedTo
in interfaceFxConvertible<PointSensitivity>
- Specified by:
convertedTo
in interfacePointSensitivity
- Parameters:
resultCurrency
- the currency of the resultrateProvider
- the provider of FX rates- Returns:
- the converted instance, which should be expressed in the specified currency
-
multipliedBy
public OvernightRateSensitivity multipliedBy(double factor)
Description copied from interface:PointSensitivityBuilder
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.
- Specified by:
multipliedBy
in interfacePointSensitivityBuilder
- Parameters:
factor
- the multiplicative factor- Returns:
- the resulting builder, replacing this builder
-
mapSensitivity
public OvernightRateSensitivity mapSensitivity(DoubleUnaryOperator operator)
Description copied from interface:PointSensitivityBuilder
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.
- Specified by:
mapSensitivity
in interfacePointSensitivityBuilder
- Parameters:
operator
- the operator to be applied to the sensitivities- Returns:
- the resulting builder, replacing this builder
-
normalize
public OvernightRateSensitivity normalize()
Description copied from interface:PointSensitivityBuilder
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.
- Specified by:
normalize
in interfacePointSensitivityBuilder
- Returns:
- the resulting builder, replacing this builder
-
buildInto
public MutablePointSensitivities buildInto(MutablePointSensitivities combination)
Description copied from interface:PointSensitivityBuilder
Builds the point sensitivity, adding to the specified mutable instance.- Specified by:
buildInto
in interfacePointSensitivityBuilder
- Parameters:
combination
- the combination object to add to- Returns:
- the specified mutable point sensitivities instance is returned, for method chaining
-
cloned
public OvernightRateSensitivity cloned()
Description copied from interface:PointSensitivityBuilder
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.
- Specified by:
cloned
in interfacePointSensitivityBuilder
- Returns:
- the built combined sensitivity
-
meta
public static OvernightRateSensitivity.Meta meta()
The meta-bean forOvernightRateSensitivity
.- Returns:
- the meta-bean, not null
-
metaBean
public OvernightRateSensitivity.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getObservation
public OvernightIndexObservation getObservation()
Gets the Overnight rate observation.This includes the index and fixing date.
- Returns:
- the value of the property, not null
-
getEndDate
public LocalDate getEndDate()
Gets the end date of the period. This must be after the fixing date. It may be the maturity date implied by the fixing date, but it may also be later.- Returns:
- the value of the property, not null
-
getCurrency
public Currency getCurrency()
Gets the currency of the sensitivity.- Specified by:
getCurrency
in interfacePointSensitivity
- Returns:
- the value of the property, not null
-
getSensitivity
public double getSensitivity()
Gets the value of the sensitivity.- Specified by:
getSensitivity
in interfacePointSensitivity
- Returns:
- the value of the property
-
-