public final class CurveSensitivities extends Object implements Sensitivities, FxConvertible<CurveSensitivities>, org.joda.beans.ImmutableBean, Serializable
Sometimes it is useful to pass in a representation of risk rather than explicitly listing the current portfolio of trades and/or positions. This target is designed to allow this.
A map of sensitivities is provided, allowing both delta and gamma to be included if desired.
| Modifier and Type | Class and Description |
|---|---|
static class |
CurveSensitivities.Meta
The meta-bean for
CurveSensitivities. |
| Modifier and Type | Method and Description |
|---|---|
static CurveSensitivitiesBuilder |
builder(PortfolioItemInfo info)
Returns a builder that can be used to create an instance of
CurveSensitivities. |
CurveSensitivities |
convertedTo(Currency resultCurrency,
FxRateProvider rateProvider)
Converts the sensitivities in this instance to an equivalent in the specified currency.
|
static CurveSensitivities |
empty()
Obtains an empty instance.
|
boolean |
equals(Object obj) |
Optional<CurrencyParameterSensitivities> |
findTypedSensitivity(CurveSensitivitiesType type)
Finds a sensitivity instance by type, returning empty if not found.
|
PortfolioItemInfo |
getInfo()
Gets the additional information.
|
ImmutableMap<CurveSensitivitiesType,CurrencyParameterSensitivities> |
getTypedSensitivities()
Gets the sensitivities, keyed by type.
|
CurrencyParameterSensitivities |
getTypedSensitivity(CurveSensitivitiesType type)
Gets a sensitivity instance by type, throwing an exception if not found.
|
int |
hashCode() |
CurveSensitivities |
mergedWith(CurveSensitivities other)
Combines this set of sensitivities with another set.
|
CurveSensitivities |
mergedWith(Map<CurveSensitivitiesType,CurrencyParameterSensitivities> other)
Merges this set of sensitivities with another set.
|
static CurveSensitivities.Meta |
meta()
The meta-bean for
CurveSensitivities. |
CurveSensitivities.Meta |
metaBean() |
static CurveSensitivities |
of(PortfolioItemInfo info,
CurveSensitivitiesType type,
CurrencyParameterSensitivities sensitivities)
Obtains an instance from a single set of sensitivities.
|
static CurveSensitivities |
of(PortfolioItemInfo info,
Map<CurveSensitivitiesType,CurrencyParameterSensitivities> typedSensitivities)
Obtains an instance from a map of sensitivities.
|
PortfolioItemSummary |
summarize() |
static Collector<CurveSensitivities,?,CurveSensitivities> |
toMergedSensitivities()
Returns a collector that merges sensitivities.
|
String |
toString() |
CurveSensitivities |
withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.
|
CurveSensitivities |
withMarketDataNames(Function<MarketDataName<?>,MarketDataName<?>> nameFn)
Checks and adjusts the market data names.
|
CurveSensitivities |
withParameterMetadatas(UnaryOperator<ParameterMetadata> mdFn)
Checks and adjusts the parameter metadata.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetIdpublic static CurveSensitivities empty()
public static CurveSensitivitiesBuilder builder(PortfolioItemInfo info)
CurveSensitivities.
The builder takes into account the parameter metadata when creating the sensitivity map. As such, the parameter metadata added to the builder must not be empty.
info - the additional informationpublic static CurveSensitivities of(PortfolioItemInfo info, CurveSensitivitiesType type, CurrencyParameterSensitivities sensitivities)
info - the additional informationtype - the type of the sensitivitiessensitivities - the sensitivitiespublic static CurveSensitivities of(PortfolioItemInfo info, Map<CurveSensitivitiesType,CurrencyParameterSensitivities> typedSensitivities)
info - the additional informationtypedSensitivities - the map of sensitivities by typepublic static Collector<CurveSensitivities,?,CurveSensitivities> toMergedSensitivities()
public CurrencyParameterSensitivities getTypedSensitivity(CurveSensitivitiesType type)
type - the type to getIllegalArgumentException - if the type is not foundpublic Optional<CurrencyParameterSensitivities> findTypedSensitivity(CurveSensitivitiesType type)
type - the type to findpublic CurveSensitivities mergedWith(Map<CurveSensitivitiesType,CurrencyParameterSensitivities> other)
This returns a new curve sensitivities with a combined map of typed sensitivities.
Any sensitivities of the same type will be combined as though using
CurrencyParameterSensitivities.mergedWith(CurrencyParameterSensitivities).
other - the other parameter sensitivitiespublic CurveSensitivities mergedWith(CurveSensitivities other)
This returns a new curve sensitivities with a combined map of typed sensitivities.
Any sensitivities of the same type will be combined as though using
CurrencyParameterSensitivities.mergedWith(CurrencyParameterSensitivities).
The identifier and attributes of this instance will take precedence.
other - the other parameter sensitivitiespublic CurveSensitivities withMarketDataNames(Function<MarketDataName<?>,MarketDataName<?>> nameFn)
The supplied function is invoked for each market data name in this sensitivities. A typical use case would be to convert index names to curve names valid for an underlying system.
nameFn - the function for checking and adjusting the nameRuntimeException - if the function throws an exceptionpublic CurveSensitivities withParameterMetadatas(UnaryOperator<ParameterMetadata> mdFn)
The supplied function is invoked for each parameter metadata in this sensitivities. If the function returns the same metadata for two different inputs, the sensitivity value will be summed. A typical use case would be to normalize parameter metadata tenors to be valid for an underlying system.
mdFn - the function for checking and adjusting the metadataRuntimeException - if the function throws an exceptionpublic CurveSensitivities convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Any FX conversion that is required will use rates from the provider.
convertedTo in interface FxConvertible<CurveSensitivities>resultCurrency - the currency of the resultrateProvider - the provider of FX ratesRuntimeException - if no FX rate could be foundpublic PortfolioItemSummary summarize()
summarize in interface PortfolioItempublic CurveSensitivities withInfo(PortfolioItemInfo info)
SensitivitieswithInfo in interface SensitivitieswithInfo in interface PortfolioIteminfo - the new infopublic static CurveSensitivities.Meta meta()
CurveSensitivities.public CurveSensitivities.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic PortfolioItemInfo getInfo()
This allows additional information to be attached to the sensitivities.
getInfo in interface SensitivitiesgetInfo in interface PortfolioItempublic ImmutableMap<CurveSensitivitiesType,CurrencyParameterSensitivities> getTypedSensitivities()
The map allows sensitivity to different types to be expressed. For example, there might be both delta and gamma sensitivity.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.