Class QuoteId
- java.lang.Object
-
- com.opengamma.strata.market.observable.QuoteId
-
- All Implemented Interfaces:
MarketDataId<Double>
,ObservableId
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class QuoteId extends Object implements ObservableId, org.joda.beans.ImmutableBean, Serializable
An identifier used to access a market quote.A quote ID identifies a piece of data in an external data provider.
Where possible, applications should use higher level IDs, instead of this class. Higher level market data keys allow the system to associate the market data with metadata when applying scenario definitions. If quote IDs are used directly, the system has no way to perturb the market data using higher level rules that rely on metadata.
The
StandardId
in a quote ID is typically the ID from an underlying data provider (e.g. Bloomberg or Reuters). However the field name is a generic name which is mapped to the field name in the underlying provider by the market data system.The reason for this difference is the different sources of the ID and field name data. The ID is typically taken from an object which is provided to any calculations, for example a security linked to the trade. The calculation rarely has to make up an ID for an object it doesn't have access to.
In contrast, calculations will often have to reference field names that aren't part their arguments. For example, if a calculation requires the last closing price of a security, it could take the ID from the security, but it needs a way to specify the field name containing the last closing price.
If the field name were specific to the market data provider, the calculation would have to be aware of the source of its market data. However, if it uses a generic field name from
FieldNames
the market data source can change without affecting the calculation.- See Also:
FieldName
, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
FieldName
getFieldName()
Gets the field name in the market data record that contains the market data item.ObservableSource
getObservableSource()
Gets the source of observable market data.StandardId
getStandardId()
Gets the identifier of the data.int
hashCode()
static org.joda.beans.TypedMetaBean<QuoteId>
meta()
The meta-bean forQuoteId
.org.joda.beans.TypedMetaBean<QuoteId>
metaBean()
static QuoteId
of(StandardId standardId)
Obtains an instance used to obtain an observable value.static QuoteId
of(StandardId standardId, FieldName fieldName)
Obtains an instance used to obtain an observable value.static QuoteId
of(StandardId standardId, FieldName fieldName, ObservableSource obsSource)
Obtains an instance used to obtain an observable value, specifying the source of observable market data.String
toString()
QuoteId
withObservableSource(ObservableSource obsSource)
Returns an identifier equivalent to this with the specified source.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.data.ObservableId
getMarketDataType
-
-
-
-
Method Detail
-
of
public static QuoteId of(StandardId standardId)
Obtains an instance used to obtain an observable value.The field name containing the data is
FieldName.MARKET_VALUE
and the market data source isObservableSource.NONE
.- Parameters:
standardId
- the standard identifier of the data in the underlying data provider- Returns:
- the identifier
-
of
public static QuoteId of(StandardId standardId, FieldName fieldName)
Obtains an instance used to obtain an observable value.The market data source is
ObservableSource.NONE
.- Parameters:
standardId
- the standard identifier of the data in the underlying data providerfieldName
- the name of the field in the market data record holding the data- Returns:
- the identifier
-
of
public static QuoteId of(StandardId standardId, FieldName fieldName, ObservableSource obsSource)
Obtains an instance used to obtain an observable value, specifying the source of observable market data.- Parameters:
standardId
- the standard identifier of the data in the underlying data providerfieldName
- the name of the field in the market data record holding the dataobsSource
- the source of observable market data- Returns:
- the identifier
-
withObservableSource
public QuoteId withObservableSource(ObservableSource obsSource)
Description copied from interface:ObservableId
Returns an identifier equivalent to this with the specified source.- Specified by:
withObservableSource
in interfaceObservableId
- Parameters:
obsSource
- the source of market data- Returns:
- the observable identifier
-
meta
public static org.joda.beans.TypedMetaBean<QuoteId> meta()
The meta-bean forQuoteId
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<QuoteId> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getStandardId
public StandardId getStandardId()
Gets the identifier of the data. This is typically an identifier from an external data provider.- Specified by:
getStandardId
in interfaceObservableId
- Returns:
- the value of the property, not null
-
getFieldName
public FieldName getFieldName()
Gets the field name in the market data record that contains the market data item. The most common field name is market value.- Specified by:
getFieldName
in interfaceObservableId
- Returns:
- the value of the property, not null
-
getObservableSource
public ObservableSource getObservableSource()
Gets the source of observable market data.- Specified by:
getObservableSource
in interfaceObservableId
- Returns:
- the value of the property, not null
-
-