Interface ScenarioMarketDataId<T,​U extends ScenarioArray<T>>

  • Type Parameters:
    T - the type of data referred to by the identifier
    U - the type of the multi-scenario data
    All Known Implementing Classes:
    QuoteScenarioArrayId

    public interface ScenarioMarketDataId<T,​U extends ScenarioArray<T>>
    Market data identifier used by functions that need access to objects containing market data for multiple scenarios.

    Many functions are written to calculate a single value at a time, for example a single present value for a trade. These functions need to consume single values of market data, for example a curve or a quoted price.

    However, it may be more efficient in some cases to calculate values for all scenarios at the same time. To do this efficiently it may be helpful to package the market data into a structure that is suitable for bulk calculations. Implementations of this interface allow these values to be requested.

    • Method Detail

      • getMarketDataId

        MarketDataId<T> getMarketDataId()
        Gets the market data identifier of the market data value.
        Returns:
        the market data identifier of the market data value
      • getScenarioMarketDataType

        java.lang.Class<U> getScenarioMarketDataType()
        Gets the type of the object containing the market data for all scenarios.
        Returns:
        the type of the object containing the market data for all scenarios
      • createScenarioValue

        U createScenarioValue​(MarketDataBox<T> marketDataBox,
                              int scenarioCount)
        Creates an instance of the scenario market data object from a box containing data of the same underlying type.

        There are many possible ways to store scenario market data for a data type. For example, if the single values are doubles, the scenario value might simply be a List<Double> or it might be a wrapper class that stores the values more efficiently in a double[].

        This method allows a scenario value of the required type to be created from a different type of scenario value or from a single value.

        Normally this method will not be used. It is assumed the required scenario values will be created by the perturbations that create scenario data. However there is no mechanism in the market data system to guarantee that scenario values of a particular type are available. If they are not, this method creates them on demand.

        Values returned from this method might be cached in the market data containers for efficiency.

        Parameters:
        marketDataBox - a market data box containing single market data values of the same type as the scenario value identified by this key
        scenarioCount - the number of scenarios for which data is required in the returned value
        Returns:
        an object containing market data for multiple scenarios built from the data in the market data box