Class ForwardFxIndexRates
- java.lang.Object
-
- com.opengamma.strata.pricer.fx.ForwardFxIndexRates
-
- All Implemented Interfaces:
MarketDataView
,ParameterizedData
,FxIndexRates
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class ForwardFxIndexRates extends Object implements FxIndexRates, org.joda.beans.ImmutableBean, Serializable
Provides access to rates for an FX index.This provides rates for a single currency pair FX index.
This implementation is based on an underlying
FxForwardRates
instance.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ForwardFxIndexRates.Meta
The meta-bean forForwardFxIndexRates
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiCurrencyAmount
currencyExposure(FxIndexSensitivity pointSensitivity)
Calculates the currency exposure from the point sensitivity.boolean
equals(Object obj)
<T> Optional<T>
findData(MarketDataName<T> name)
Finds the market data with the specified name.LocalDateDoubleTimeSeries
getFixings()
Gets the time-series of fixings, defaulted to an empty time-series.FxForwardRates
getFxForwardRates()
Gets the underlying FX forward rates.FxIndex
getIndex()
Gets the index that the rates are for.double
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.int
getParameterCount()
Gets the number of parameters.ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.LocalDate
getValuationDate()
Gets the valuation date.int
hashCode()
static ForwardFxIndexRates.Meta
meta()
The meta-bean forForwardFxIndexRates
.ForwardFxIndexRates.Meta
metaBean()
static ForwardFxIndexRates
of(FxIndex index, FxForwardRates fxForwardRates)
Obtains an instance based on discount factors with no historic fixings.static ForwardFxIndexRates
of(FxIndex index, FxForwardRates fxForwardRates, LocalDateDoubleTimeSeries fixings)
Obtains an instance based on discount factors and historic fixings.CurrencyParameterSensitivities
parameterSensitivity(FxIndexSensitivity pointSensitivity)
Calculates the parameter sensitivity from the point sensitivity.double
rate(FxIndexObservation observation, Currency baseCurrency)
Gets the historic or forward rate at the specified fixing date.PointSensitivityBuilder
ratePointSensitivity(FxIndexObservation observation, Currency baseCurrency)
Calculates the point sensitivity of the historic or forward rate at the specified fixing date.String
toString()
ForwardFxIndexRates
withFxForwardRates(FxForwardRates fxForwardRates)
Returns a new instance with different FX forward rates.ForwardFxIndexRates
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.ForwardFxIndexRates
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex
-
-
-
-
Method Detail
-
of
public static ForwardFxIndexRates of(FxIndex index, FxForwardRates fxForwardRates)
Obtains an instance based on discount factors with no historic fixings.The instance is based on the discount factors for each currency.
- Parameters:
index
- the indexfxForwardRates
- the underlying forward FX rates- Returns:
- the rates instance
-
of
public static ForwardFxIndexRates of(FxIndex index, FxForwardRates fxForwardRates, LocalDateDoubleTimeSeries fixings)
Obtains an instance based on discount factors and historic fixings.The instance is based on the discount factors for each currency.
- Parameters:
index
- the indexfxForwardRates
- the underlying forward FX ratesfixings
- the time-series of fixings- Returns:
- the rates instance
-
getValuationDate
public LocalDate getValuationDate()
Description copied from interface:MarketDataView
Gets the valuation date.The raw data in this provider is calibrated for this date.
- Specified by:
getValuationDate
in interfaceMarketDataView
- Returns:
- the valuation date
-
findData
public <T> Optional<T> findData(MarketDataName<T> name)
Description copied from interface:MarketDataView
Finds the market data with the specified name.This is most commonly used to find an underlying curve or surface by name. If the market data cannot be found, empty is returned.
- Specified by:
findData
in interfaceMarketDataView
- Type Parameters:
T
- the type of the market data value- Parameters:
name
- the name to find- Returns:
- the market data value, empty if not found
-
getParameterCount
public int getParameterCount()
Description copied from interface:ParameterizedData
Gets the number of parameters.This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.
- Specified by:
getParameterCount
in interfaceParameterizedData
- Returns:
- the number of parameters
-
getParameter
public double getParameter(int parameterIndex)
Description copied from interface:ParameterizedData
Gets the value of the parameter at the specified index.- Specified by:
getParameter
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the value of the parameter
-
getParameterMetadata
public ParameterMetadata getParameterMetadata(int parameterIndex)
Description copied from interface:ParameterizedData
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Specified by:
getParameterMetadata
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
-
withParameter
public ForwardFxIndexRates withParameter(int parameterIndex, double newValue)
Description copied from interface:ParameterizedData
Returns a copy of the data with the value at the specified index altered.This instance is immutable and unaffected by this method call.
- Specified by:
withParameter
in interfaceFxIndexRates
- Specified by:
withParameter
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to getnewValue
- the new value for the specified parameter- Returns:
- a parameterized data instance based on this with the specified parameter altered
-
withPerturbation
public ForwardFxIndexRates withPerturbation(ParameterPerturbation perturbation)
Description copied from interface:ParameterizedData
Returns a perturbed copy of the data.The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.
This instance is immutable and unaffected by this method call.
- Specified by:
withPerturbation
in interfaceFxIndexRates
- Specified by:
withPerturbation
in interfaceParameterizedData
- Parameters:
perturbation
- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
rate
public double rate(FxIndexObservation observation, Currency baseCurrency)
Description copied from interface:FxIndexRates
Gets the historic or forward rate at the specified fixing date.The rate of the FX index varies over time. This method obtains the actual or estimated rate for the fixing date.
This retrieves the actual rate if the fixing date is before the valuation date, or the estimated rate if the fixing date is after the valuation date. If the fixing date equals the valuation date, then the best available rate is returned.
The index defines the conversion rate for a specific currency pair. This method specifies which of the two currencies in the index is to be treated as the base currency for the purposes of the returned rate. If the specified base currency equals the base currency of the index, then the rate is simply returned. If the specified base currency equals the counter currency of the index, then the inverse rate is returned. As such, an amount in the specified base currency can be directly multiplied by the returned FX rate to perform FX conversion.
To convert an amount in the specified base currency to the other currency, multiply it by the returned FX rate.
- Specified by:
rate
in interfaceFxIndexRates
- Parameters:
observation
- the rate observation, including the fixing datebaseCurrency
- the base currency that the rate should be expressed against- Returns:
- the rate of the index, either historic or forward
-
ratePointSensitivity
public PointSensitivityBuilder ratePointSensitivity(FxIndexObservation observation, Currency baseCurrency)
Description copied from interface:FxIndexRates
Calculates the point sensitivity of the historic or forward rate at the specified fixing date.This returns a sensitivity instance referring to the points that were queried in the market data. If a time-series was used, then there is no sensitivity. The sensitivity refers to the result of
FxIndexRates.rate(FxIndexObservation, Currency)
.- Specified by:
ratePointSensitivity
in interfaceFxIndexRates
- Parameters:
observation
- the rate observation, including the fixing datebaseCurrency
- the base currency that the rate should be expressed against- Returns:
- the point sensitivity of the rate
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(FxIndexSensitivity pointSensitivity)
Description copied from interface:FxIndexRates
Calculates the parameter sensitivity from the point sensitivity.This is used to convert a single point sensitivity to parameter sensitivity.
- Specified by:
parameterSensitivity
in interfaceFxIndexRates
- Parameters:
pointSensitivity
- the point sensitivity to convert- Returns:
- the parameter sensitivity
-
currencyExposure
public MultiCurrencyAmount currencyExposure(FxIndexSensitivity pointSensitivity)
Description copied from interface:FxIndexRates
Calculates the currency exposure from the point sensitivity.This is used to convert a single point sensitivity to currency exposure.
- Specified by:
currencyExposure
in interfaceFxIndexRates
- Parameters:
pointSensitivity
- the point sensitivity to convert- Returns:
- the currency exposure
-
withFxForwardRates
public ForwardFxIndexRates withFxForwardRates(FxForwardRates fxForwardRates)
Returns a new instance with different FX forward rates.- Parameters:
fxForwardRates
- the new FX forward rates- Returns:
- the new instance
-
meta
public static ForwardFxIndexRates.Meta meta()
The meta-bean forForwardFxIndexRates
.- Returns:
- the meta-bean, not null
-
metaBean
public ForwardFxIndexRates.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getIndex
public FxIndex getIndex()
Gets the index that the rates are for.- Specified by:
getIndex
in interfaceFxIndexRates
- Returns:
- the value of the property, not null
-
getFxForwardRates
public FxForwardRates getFxForwardRates()
Gets the underlying FX forward rates.- Specified by:
getFxForwardRates
in interfaceFxIndexRates
- Returns:
- the value of the property, not null
-
getFixings
public LocalDateDoubleTimeSeries getFixings()
Gets the time-series of fixings, defaulted to an empty time-series. This includes the known historical fixings and may be empty.- Specified by:
getFixings
in interfaceFxIndexRates
- Returns:
- the value of the property, not null
-
-