Interface MarketDataFactory


  • public interface MarketDataFactory
    Component that provides the ability to source and calibrate market data.

    This component is used to create market data within Strata. Each method receives a set of requirements defining the market data that is required. This is typically obtained from CalculationTasks.requirements(ReferenceData).

    Given the requirements, the factory will determine whether any raw market data is needed. This may use the MarketDataConfig to provide additional information.

    If raw market data is required, the ObservableDataProvider and TimeSeriesProvider will be invoked to supply it. Applications can implement these to supply data from an external source. Alternatively, the raw market data can be passed into each method using the suppliedData parameter.

    Once the raw data is obtained, the factory will determine whether it needs to be calibrated, which may also involve additional information from the MarketDataConfig.

    Two types of output can be built. The create method is used to obtain and calibrate a single set of market data. By contrast, the createMultiScenario methods are used to create data with multiple scenarios based on a ScenarioDefinition.

    • Method Detail

      • of

        static MarketDataFactory of​(ObservableDataProvider observableDataProvider,
                                    TimeSeriesProvider timeSeriesProvider,
                                    MarketDataFunction<?,​?>... functions)
        Obtains an instance of the factory based on providers of market data and time-series.

        The market data functions are used to build the market data.

        Parameters:
        observableDataProvider - the provider of observable market data
        timeSeriesProvider - the provider of time-series
        functions - the functions that create the market data
        Returns:
        the market data factory
      • of

        static com.opengamma.strata.calc.marketdata.DefaultMarketDataFactory of​(ObservableDataProvider observableDataProvider,
                                                                                TimeSeriesProvider timeSeriesProvider,
                                                                                java.util.List<MarketDataFunction<?,​?>> functions)
        Obtains an instance of the factory based on providers of market data and time-series.

        The market data functions are used to build the market data.

        Parameters:
        observableDataProvider - the provider of observable market data
        timeSeriesProvider - the provider of time-series
        functions - the functions that create the market data
        Returns:
        the market data factory
      • create

        BuiltMarketData create​(MarketDataRequirements requirements,
                               MarketDataConfig marketDataConfig,
                               MarketData suppliedData,
                               ReferenceData refData)
        Builds a set of market data.

        This builds market data based on the specified requirements and configuration. If some market data is known, it can be supplied using the MarketData interface. Only data not already present in the suppliedData will be built.

        Parameters:
        requirements - the market data required for the calculations
        marketDataConfig - configuration needed to build non-observable market data, for example curves or surfaces
        suppliedData - market data supplied by the user
        refData - the reference data
        Returns:
        the market data required by the calculations plus details of any data that could not be built
      • createMultiScenario

        BuiltScenarioMarketData createMultiScenario​(MarketDataRequirements requirements,
                                                    MarketDataConfig marketDataConfig,
                                                    MarketData suppliedData,
                                                    ReferenceData refData,
                                                    ScenarioDefinition scenarioDefinition)
        Builds the market data required for performing calculations for a set of scenarios.

        This builds market data based on the specified requirements and configuration. If some market data is known, it can be supplied using the MarketData interface. Only data not already present in the suppliedData will be built. The scenario definition will be applied, potentially generating multiple sets of market data.

        If the scenario definition contains perturbations that apply to the inputs used to build market data, the data must be built by this method, not provided in suppliedData.

        For example, if a perturbation is defined that shocks the par rates used to build a curve, the curve must not be provided in suppliedData. The factory will only build the curve using the par rates if it is not found in suppliedData.

        Parameters:
        requirements - the market data required for the calculations
        marketDataConfig - configuration needed to build non-observable market data, for example curves or surfaces
        suppliedData - the base market data used to derive the data for each scenario
        refData - the reference data
        scenarioDefinition - defines how the market data for each scenario is derived from the base data
        Returns:
        the market data required by the calculations
      • createMultiScenario

        BuiltScenarioMarketData createMultiScenario​(MarketDataRequirements requirements,
                                                    MarketDataConfig marketDataConfig,
                                                    ScenarioMarketData suppliedData,
                                                    ReferenceData refData,
                                                    ScenarioDefinition scenarioDefinition)
        Builds the market data required for performing calculations for a set of scenarios.

        This builds market data based on the specified requirements and configuration. If some market data is known, it can be supplied using the ScenarioMarketData interface. Only data not already present in the suppliedData will be built. The scenario definition will be applied, potentially generating multiple sets of market data. The number of scenarios in the supplied data must match that of the scenario definition.

        If the scenario definition contains perturbations that apply to the inputs used to build market data, the data must be built by this method, not provided in suppliedData.

        For example, if a perturbation is defined that shocks the par rates used to build a curve, the curve must not be provided in suppliedData. The factory will only build the curve using the par rates if it is not found in suppliedData.

        Parameters:
        requirements - the market data required for the calculations
        marketDataConfig - configuration needed to build non-observable market data, for example curves or surfaces
        suppliedData - the base market data used to derive the data for each scenario
        refData - the reference data
        scenarioDefinition - defines how the market data for each scenario is derived from the base data
        Returns:
        the market data required by the calculations