public interface MarketData
Market data is looked up using subclasses of MarketDataId.
All data is valid for a single date, defined by getValuationDate().
When performing calculations with scenarios, only the data of a single scenario is accessible.
The standard implementation is ImmutableMarketData.
| Modifier and Type | Method and Description |
|---|---|
default MarketData |
combinedWith(MarketData other)
Combines this market data with another.
|
default boolean |
containsValue(MarketDataId<?> id)
Checks if this market data contains a value for the specified identifier.
|
static MarketData |
empty(LocalDate valuationDate)
Obtains an instance containing no market data.
|
<T> Set<MarketDataId<T>> |
findIds(MarketDataName<T> name)
Finds the market data identifiers associated with the specified name.
|
<T> Optional<T> |
findValue(MarketDataId<T> id)
Finds the market data value associated with the specified identifier.
|
Set<MarketDataId<?>> |
getIds()
Gets the market data identifiers.
|
LocalDateDoubleTimeSeries |
getTimeSeries(ObservableId id)
Gets the time-series identified by the specified identifier, empty if not found.
|
Set<ObservableId> |
getTimeSeriesIds()
Gets the time-series identifiers.
|
LocalDate |
getValuationDate()
Gets the valuation date of the market data.
|
default <T> T |
getValue(MarketDataId<T> id)
Gets the market data value associated with the specified identifier.
|
static MarketData |
of(LocalDate valuationDate,
Map<? extends MarketDataId<?>,?> values)
Obtains an instance from a valuation date and map of values.
|
static MarketData |
of(LocalDate valuationDate,
Map<? extends MarketDataId<?>,?> values,
Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
Obtains an instance from a valuation date, map of values and time-series.
|
default <T> MarketData |
withValue(MarketDataId<T> id,
T value)
Returns a copy of this market data with the specified value.
|
static MarketData of(LocalDate valuationDate, Map<? extends MarketDataId<?>,?> values)
Each entry in the map is a single piece of market data, keyed by the matching identifier.
For example, an FxRate can be looked up using an FxRateId.
The caller must ensure that the each entry in the map corresponds with the parameterized
type on the identifier.
valuationDate - the valuation date of the market datavalues - the market data valuesClassCastException - if a value does not match the parameterized type associated with the identifierstatic MarketData of(LocalDate valuationDate, Map<? extends MarketDataId<?>,?> values, Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
valuationDate - the valuation date of the market datavalues - the market data valuestimeSeries - the time-seriesClassCastException - if a value does not match the parameterized type associated with the identifierstatic MarketData empty(LocalDate valuationDate)
valuationDate - the valuation date of the market dataLocalDate getValuationDate()
All values accessible through this interface have the same valuation date.
default boolean containsValue(MarketDataId<?> id)
id - the identifier to finddefault <T> T getValue(MarketDataId<T> id)
If this market data instance contains the identifier, the value will be returned. Otherwise, an exception will be thrown.
T - the type of the market data valueid - the identifier to findMarketDataNotFoundException - if the identifier is not found<T> Optional<T> findValue(MarketDataId<T> id)
If this market data instance contains the identifier, the value will be returned. Otherwise, an empty optional will be returned.
T - the type of the market data valueid - the identifier to findSet<MarketDataId<?>> getIds()
<T> Set<MarketDataId<T>> findIds(MarketDataName<T> name)
This returns the unique identifiers that refer to the specified name. There may be more than one identifier associated with a name as the name is not unique.
T - the type of the market data valuename - the name to findSet<ObservableId> getTimeSeriesIds()
LocalDateDoubleTimeSeries getTimeSeries(ObservableId id)
id - the identifier to finddefault MarketData combinedWith(MarketData other)
The result combines both sets of market data. Values are taken from this set of market data if available, otherwise they are taken from the other set.
The valuation dates of the sets of market data must be the same.
other - the other market datadefault <T> MarketData withValue(MarketDataId<T> id, T value)
When the result is queried for the specified identifier, the specified value will be returned.
For example, this method could be used to replace a curve with a bumped curve.
T - the type of the market data valueid - the identifier to findvalue - the value to associate with the identifierCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.