Class ImmutableScenarioMarketData

    • Method Detail

      • of

        public static ImmutableScenarioMarketData of​(int scenarioCount,
                                                     LocalDate valuationDate,
                                                     Map<? extends MarketDataId<?>,​MarketDataBox<?>> values,
                                                     Map<? extends ObservableId,​LocalDateDoubleTimeSeries> timeSeries)
        Obtains an instance from a valuation date, map of values and time-series.

        The valuation date and map of values must have the same number of scenarios.

        Parameters:
        scenarioCount - the number of scenarios
        valuationDate - the valuation dates associated with all scenarios
        values - the market data values, one for each scenario
        timeSeries - the time-series
        Returns:
        a set of market data containing the values in the map
      • of

        public static ImmutableScenarioMarketData of​(int scenarioCount,
                                                     MarketDataBox<LocalDate> valuationDate,
                                                     Map<? extends MarketDataId<?>,​MarketDataBox<?>> values,
                                                     Map<? extends ObservableId,​LocalDateDoubleTimeSeries> timeSeries)
        Obtains an instance from a valuation date, map of values and time-series.

        The valuation date and map of values must have the same number of scenarios.

        Parameters:
        scenarioCount - the number of scenarios
        valuationDate - the valuation dates associated with the market data, one for each scenario
        values - the market data values, one for each scenario
        timeSeries - the time-series
        Returns:
        a set of market data containing the values in the map
      • empty

        public static ImmutableScenarioMarketData empty()
        Obtains a market data instance that contains no data and has no scenarios.
        Returns:
        an empty instance
      • builder

        public static ImmutableScenarioMarketDataBuilder builder​(LocalDate valuationDate)
        Creates a mutable builder that can be used to create an instance of the market data.
        Parameters:
        valuationDate - the valuation date associated with the market data
        Returns:
        the mutable builder
      • builder

        public static ImmutableScenarioMarketDataBuilder builder​(MarketDataBox<LocalDate> valuationDate)
        Creates a mutable builder that can be used to create an instance of the market data.
        Parameters:
        valuationDate - the valuation dates associated with the market data, one for each scenario
        Returns:
        the mutable builder
      • 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 interface ScenarioMarketData
        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 interface ScenarioMarketData
        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 interface ScenarioMarketData
        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
      • 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 interface ScenarioMarketData
        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 interface ScenarioMarketData
        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 interface ScenarioMarketData
        Parameters:
        id - the identifier to find
        Returns:
        the time-series, empty if no time-series found
      • combinedWith

        public ImmutableScenarioMarketData combinedWith​(ImmutableScenarioMarketData other)
        Returns set of market data which combines the data from this set of data with another set.

        If the same item of data is available in both sets, it will be taken from this set.

        Both sets of data must contain the same number of scenarios, or one of them must have one scenario. If one of the sets of data has one scenario, the combined set will have the scenario count of the other set.

        The valuation dates are taken from this set of data.

        Parameters:
        other - another set of market data
        Returns:
        a set of market data combining the data in this set with the data in the other
      • combinedWith

        public ScenarioMarketData combinedWith​(ScenarioMarketData other)
        Description copied from interface: ScenarioMarketData
        Returns set of market data which combines the data from this set of data with another set.

        If the same item of data is available in both sets, it will be taken from this set.

        Both sets of data must contain the same number of scenarios, or one of them must have one scenario. If one of the sets of data has one scenario, the combined set will have the scenario count of the other set.

        Specified by:
        combinedWith in interface ScenarioMarketData
        Parameters:
        other - another set of market data
        Returns:
        a set of market data combining the data in this set with the data in the other
      • getScenarioCount

        public int getScenarioCount()
        Gets the number of scenarios.
        Specified by:
        getScenarioCount in interface ScenarioMarketData
        Returns:
        the value of the property
      • getTimeSeries

        public ImmutableMap<ObservableId,​LocalDateDoubleTimeSeries> getTimeSeries()
        Gets the time-series of market data values.

        If a request is made for a time-series that is not in the map, an empty series will be returned.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object