Class BuiltScenarioMarketData
- java.lang.Object
-
- com.opengamma.strata.calc.marketdata.BuiltScenarioMarketData
-
- All Implemented Interfaces:
ScenarioMarketData
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class BuiltScenarioMarketData extends Object implements ScenarioMarketData, org.joda.beans.ImmutableBean
Market data that has been built.The
MarketDataFactory
can be used to build market data from external sources and by calibration. This implementation ofScenarioMarketData
provides the result, and includes all the market data, such as quotes and curves.This implementation differs from
ImmutableScenarioMarketData
because it stores the failures that occurred during the build process. These errors are exposed to users when data is queried.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BuiltScenarioMarketData.Meta
The meta-bean forBuiltScenarioMarketData
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsValue(MarketDataId<?> id)
Checks if this market data contains a value for the specified identifier.boolean
equals(Object obj)
<T> Set<MarketDataId<T>>
findIds(MarketDataName<T> name)
Finds the market data identifiers associated with the specified name.<T> Optional<MarketDataBox<T>>
findValue(MarketDataId<T> id)
Finds the market data value associated with the specified identifier.Set<MarketDataId<?>>
getIds()
Gets the market data identifiers.int
getScenarioCount()
Gets the number of scenarios.LocalDateDoubleTimeSeries
getTimeSeries(ObservableId id)
Gets the time-series associated with the specified identifier, empty if not found.ImmutableMap<MarketDataId<?>,Failure>
getTimeSeriesFailures()
Gets the failures that occurred when building time series of market data values.Set<ObservableId>
getTimeSeriesIds()
Gets the time-series identifiers.ImmutableScenarioMarketData
getUnderlying()
Gets the underlying market data.MarketDataBox<LocalDate>
getValuationDate()
Gets a box that can provide the valuation date of each scenario.<T> MarketDataBox<T>
getValue(MarketDataId<T> id)
Gets the market data value associated with the specified identifier.ImmutableMap<MarketDataId<?>,Failure>
getValueFailures()
Gets the failures when building single market data values.int
hashCode()
static BuiltScenarioMarketData.Meta
meta()
The meta-bean forBuiltScenarioMarketData
.BuiltScenarioMarketData.Meta
metaBean()
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.data.scenario.ScenarioMarketData
combinedWith, getScenarioValue, scenario, scenarios, withPerturbation, withValue
-
-
-
-
Method Detail
-
getValuationDate
public MarketDataBox<LocalDate> getValuationDate()
Description copied from interface:ScenarioMarketData
Gets a box that can provide the valuation date of each scenario.- Specified by:
getValuationDate
in interfaceScenarioMarketData
- Returns:
- the valuation dates of the scenarios
-
getScenarioCount
public int getScenarioCount()
Description copied from interface:ScenarioMarketData
Gets the number of scenarios.- Specified by:
getScenarioCount
in interfaceScenarioMarketData
- Returns:
- the number of scenarios
-
containsValue
public boolean containsValue(MarketDataId<?> id)
Description copied from interface:ScenarioMarketData
Checks if this market data contains a value for the specified identifier.- Specified by:
containsValue
in interfaceScenarioMarketData
- Parameters:
id
- the identifier to find- Returns:
- true if the market data contains a value for the identifier
-
getValue
public <T> MarketDataBox<T> getValue(MarketDataId<T> id)
Description copied from interface:ScenarioMarketData
Gets the market data value associated with the specified identifier.The result is a box that provides data for all scenarios. If this market data instance contains the identifier, the value will be returned. Otherwise, an exception will be thrown.
- Specified by:
getValue
in interfaceScenarioMarketData
- Type Parameters:
T
- the type of the market data value- Parameters:
id
- the identifier to find- Returns:
- the market data value box providing data for all scenarios
-
findValue
public <T> Optional<MarketDataBox<T>> findValue(MarketDataId<T> id)
Description copied from interface:ScenarioMarketData
Finds the market data value associated with the specified identifier.The result is a box that provides data for all scenarios. If this market data instance contains the identifier, the value will be returned. Otherwise, an empty optional will be returned.
- Specified by:
findValue
in interfaceScenarioMarketData
- Type Parameters:
T
- the type of the market data value- Parameters:
id
- the identifier to find- Returns:
- the market data value box providing data for all scenarios, empty if not found
-
getIds
public Set<MarketDataId<?>> getIds()
Description copied from interface:ScenarioMarketData
Gets the market data identifiers.- Specified by:
getIds
in interfaceScenarioMarketData
- Returns:
- the set of market data identifiers
-
findIds
public <T> Set<MarketDataId<T>> findIds(MarketDataName<T> name)
Description copied from interface:ScenarioMarketData
Finds the market data identifiers associated with the specified 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.
- Specified by:
findIds
in interfaceScenarioMarketData
- Type Parameters:
T
- the type of the market data value- Parameters:
name
- the name to find- Returns:
- the set of market data identifiers, empty if name not found
-
getTimeSeriesIds
public Set<ObservableId> getTimeSeriesIds()
Description copied from interface:ScenarioMarketData
Gets the time-series identifiers.Time series are not affected by scenarios, therefore there is a single time-series for each identifier which is shared between all scenarios.
- Specified by:
getTimeSeriesIds
in interfaceScenarioMarketData
- Returns:
- the set of observable identifiers
-
getTimeSeries
public LocalDateDoubleTimeSeries getTimeSeries(ObservableId id)
Description copied from interface:ScenarioMarketData
Gets the time-series associated with the specified identifier, empty if not found.Time series are not affected by scenarios, therefore there is a single time-series for each identifier which is shared between all scenarios.
- Specified by:
getTimeSeries
in interfaceScenarioMarketData
- Parameters:
id
- the identifier to find- Returns:
- the time-series, empty if no time-series found
-
meta
public static BuiltScenarioMarketData.Meta meta()
The meta-bean forBuiltScenarioMarketData
.- Returns:
- the meta-bean, not null
-
metaBean
public BuiltScenarioMarketData.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getUnderlying
public ImmutableScenarioMarketData getUnderlying()
Gets the underlying market data.- Returns:
- the value of the property, not null
-
getValueFailures
public ImmutableMap<MarketDataId<?>,Failure> getValueFailures()
Gets the failures when building single market data values.- Returns:
- the value of the property, not null
-
getTimeSeriesFailures
public ImmutableMap<MarketDataId<?>,Failure> getTimeSeriesFailures()
Gets the failures that occurred when building time series of market data values.- Returns:
- the value of the property, not null
-
-