Market data retrieval in the preview market data API data model
The preview market data API allows the retrieval of either:
- a single market data corresponding to a key defining the market data
- all the market data corresponding to a curve, a surface, or a cube
Market data retrieval interfaces
Interfaces for market data retrieval are defined in the package com.activeviam.mr.common.services.marketdata.retrievers.intf
Interface | Description | Details |
---|---|---|
IMarketDataRetriever |
Interface for a market data retriever. | Used for the retrieval of one quote, e.g.: |
for (asOfDate, marketDataSet, instrumentId) | ||
for (asOfDate, marketDataSet, curveId, tenor) | ||
for (asOfDate, marketDataSet, surfaceId, tenor, moneyness) | ||
for (asOfDate, marketDataSet, cubeId, tenor, moneyness, underlyingMaturity) | ||
ICurveMarketDataRetriever |
Interface for a market data retriever for curve (1-axis) market data. | Used for the retrieval of all the quotes corresponding to a curve. |
ISurfaceMarketDataRetriever |
Interface for a market data retriever for surface (2-axis) market data. | Used for the retrieval of all the quotes corresponding to a surface. |
ICubeMarketDataRetriever |
Interface for a market data retriever for cube (3-axis) market data. | Used for the retrieval of all the quotes corresponding to a cube. |
Market data retrieval implementations
Implementations for market data retrieval are defined in the package com.activeviam.mr.common.services.marketdata.retrievers.impl
.
Class | Description | Details |
---|---|---|
TableSingleMarketDataRetriever |
Implementation of IMarketDataRetriever . |
Returns a Double value representing the quote defined by an Object... varargs defining the key, e.g.: |
for (asOfDate, marketDataSet, instrumentId) | ||
for (asOfDate, marketDataSet, curveId, tenor) | ||
for (asOfDate, marketDataSet, surfaceId, tenor, moneyness) | ||
for (asOfDate, marketDataSet, cubeId, tenor, moneyness, underlyingMaturity) | ||
TableCurveMarketDataRetriever |
Implementation of ICurveMarketDataRetriever . |
Returns a CurveMarketData value representing all the quotes defined by (asOfDate, marketDataSet, curveId). |
TableSurfaceMarketDataRetriever |
Implementation of ISurfaceMarketDataRetriever . |
Returns a SurfaceMarketData value representing all the quotes defined by (asOfDate, marketDataSet, surfaceId). |
TableCubeMarketDataRetriever |
Implementation of ICubeMarketDataRetriever . |
Returns a CubeMarketData value representing all the quotes defined by (asOfDate, marketDataSet, cubeId). |
MarketDataDateShift
The MarketDataDateShift
defined in the package com.activeviam.mr.common.services.marketdata.dates.impl
is an enum with the following values:
Value | Details |
---|---|
TODAY |
Used to retrieve the current day with regard to a base date. |
NEXT_DAY |
Used to retrieve the next day with regard to a base date. |
PREVIOUS_DAY |
Used to retrieve the previous day with regard to a base date. |
Retrieval context
The market data retrieval context is defined in the class MarketDataContext
in the package com.activeviam.mr.common.services.marketdata.context
.
It is used to define:
- the name of the retrieval
- the query cache that is used
- the
MarketDataDateShift
(see above).
It is defined in the class MarketDataContext
in the package com.activeviam.mr.common.services.marketdata.context
.
Date retrieval interfaces
Interfaces for date retrieval are defined in the package com.activeviam.mr.common.services.marketdata.dates.intf
Interface | Description | Details |
---|---|---|
IDateRetrievalService |
Interface to retrieve all the asOfDates present in market data inputs | Used for the retrieval of the previous or the next day with regards to a given asOfDate. |
IMarketDataDateService |
Interface for the retrieval of the current, previous or the next day with regard to a given asOfDate | Takes an asOfDate and a MarketDataContext object as inputs. |
Date retrieval implementations
Implementations for date retrieval are defined in the package com.activeviam.mr.common.services.marketdata.dates.impl
.
Interface | Description | Details |
---|---|---|
TableDateRetrievalService |
Implementation of IDateRetrievalService . |
Returns all the dates present in a given table in an IDatabase object. |
MarketDataDateService |
Implementation of IMarketDataDateService . |
Returns a shifted date (i.e. the current, next or previous date) with an asOfDate and a MarketDataContext object as inputs. |
Key Translator Interface
The interface used to translate a key used to retrieve market data (i.e. modify the key based on a given MarketDataContext
(see above)) is defined in the package
com.activeviam.mr.common.services.marketdata.keys.intf
.
The translation is meant to modify the asOfDate passed in the key in order to return a key containing the previous or next day with regard to the original asOfDate.
Interface | Description | Details |
---|---|---|
IMarketDataKeyTranslator |
Interface for market data key translators | Uses IMarketDataDateService to translate a key based on a MarketDataContext . |
Key Translator Implementation
The implementation used to translate a key used to retrieve market data is defined in the package
com.activeviam.mr.common.services.marketdata.keys.impl
.
Interface | Description | Details |
---|---|---|
DatabaseMarketDataKeyTranslator |
Implementation of IMarketDataKeyTranslator . |
Gets the index of the AS_OF_DATE field in a table defined in an IDatabase to translate the key based on a MarketDataContext . |
Market data retrieval service
The MarketDataRetrievalService
(in com.activeviam.mr.common.services.marketdata.service.impl
) combines a market data retriever with a market data key translator appropriate for a given store. Several methods are available on the service:
Method | Return type | Details |
---|---|---|
getMarketDataRetriever() |
IMarketDataRetriever |
Provides direct access to the retriever. |
getMarketDataKeyTranslator() |
IMarketDataKeyTranslator |
Provides direct access to the key translator. |
getMarketData(K key, MarketDataContext context) |
V - generic return type for the market data value |
Retrieves the market data for the given key and context. |
getUntranslatedMarketData(K key) |
V - generic return type for the market data value |
Retrieves market data for the given key, without applying the key translator. |
getTranslatedKey(K key, MarketDataContext context) |
K - generic type of the market data key |
Returns a translated key given a context. |
getShiftedDate(LocalDate baseDate, MarketDataContext context) |
LocalDate |
Returns a shifted date given a date and context. |
getName() |
String |
Returns the name of the retriever. |
Implementations of the market data retrieval service are included with the store configuration classes in the mr-common-config
module.
Market data service
The market data service collects the retrieval services and allows the selection of a particular retrieval service by name.
The service is found in the com.activeviam.mr.common.services.marketdata.service.intf
and com.activeviam.mr.common.services.marketdata.service.impl
packages.
Class | Details |
---|---|
IMarketDataService |
Provides a single getRetrievalService(String name) method returning a MarketDataRetrievalService . |
TableMarketDataService |
Implementation of IMarketDataService for storing market data retrieval services that retrieve Double values using an Object[] key. |
Spring configuration classes
Spring configuration of the market data retrieval service is provided in the com.activeviam.mr.common.services.marketdata.service
and the com.activeviam.mr.common.datastore.description.stores
packages of the mr-common-config
module.
Class | Details |
---|---|
InstrumentMarketDataStoreConfig |
Publishes MarketDataRetrievalService bean for the store. |
CurveMarketDataStoreConfig |
Publishes MarketDataRetrievalService and ICurveMarketDataRetriever beans for the store. |
SurfaceMarketDataStoreConfig |
Publishes MarketDataRetrievalService and ISurfaceMarketDataRetriever beans for the store. |
CubeMarketDataStoreConfig |
Publishes MarketDataRetrievalService and ICubeMarketDataRetriever beans for the store. |
TableMarketDataRetrievalServiceConfig |
Collects all MarketDataRetrievalService beans and publishes a TableMarketDataService instance as an IMarketDataService bean. |