Logo
Reference manual - version ored_version
Public Member Functions | List of all members
EngineFactory Class Reference

Pricing Engine Factory class. More...

#include <ored/portfolio/enginefactory.hpp>

Public Member Functions

 EngineFactory (const boost::shared_ptr< EngineData > &data, const boost::shared_ptr< Market > &market, const map< MarketContext, string > &configurations=std::map< MarketContext, string >(), const boost::shared_ptr< ReferenceDataManager > &referenceData=nullptr, const IborFallbackConfig &iborFallbackConfig=IborFallbackConfig::defaultConfig(), const std::vector< boost::shared_ptr< EngineBuilder >> extraEngineBuilders={}, const bool allowOverwrite=false)
 Create an engine factory. More...
 
const boost::shared_ptr< Market > & market () const
 Return the market used by this EngineFactory.
 
const map< MarketContext, string > & configurations () const
 Return the market configurations used by this EngineFactory.
 
const string & configuration (const MarketContext &key)
 Return a configuration (or the default one if key not found)
 
const boost::shared_ptr< EngineDataengineData () const
 Return the EngineData parameters.
 
void registerBuilder (const boost::shared_ptr< EngineBuilder > &builder, const bool allowOverwrite=false)
 Register a builder with the factory.
 
const boost::shared_ptr< ReferenceDataManager > & referenceData () const
 Return the reference data used by this EngineFactory.
 
const IborFallbackConfigiborFallbackConfig () const
 Return the ibor fallback config.
 
boost::shared_ptr< EngineBuilderbuilder (const string &tradeType)
 Get a builder by trade type. More...
 
void registerLegBuilder (const boost::shared_ptr< LegBuilder > &legBuilder, const bool allowOverwrite=false)
 Register a leg builder with the factory.
 
boost::shared_ptr< LegBuilderlegBuilder (const string &legType)
 Get a leg builder by leg type.
 
void addDefaultBuilders ()
 Add a set of default engine and leg builders.
 
void addExtraBuilders (const std::vector< boost::shared_ptr< EngineBuilder >> extraEngineBuilders, const std::vector< boost::shared_ptr< LegBuilder >> extraLegBuilders, const bool allowOverwrite=false)
 Add a set of default engine and leg builders, overwrite existing builders with same key if specified.
 
void clear ()
 Clear all builders.
 
set< std::pair< string, boost::shared_ptr< QuantExt::ModelBuilder > > > modelBuilders () const
 return model builders
 

Detailed Description

Pricing Engine Factory class.

A Pricing Engine Factory is used when building a portfolio, it provides QuantLib::PricingEngines to each of the Trade objects.

An Engine Factory is configured on two levels, both from EngineData. The first level is the type of builder (Model and Engine) to use for each trade type, so given a trade type one asks the factory for a builder and then the builder for a PricingEngine. Each builder must be registered with the factory and then the configuration defines which builder to use.

Secondly, the factory maintains builder specific parameters for each Model and Engine.

Constructor & Destructor Documentation

◆ EngineFactory()

EngineFactory ( const boost::shared_ptr< EngineData > &  data,
const boost::shared_ptr< Market > &  market,
const map< MarketContext, string > &  configurations = std::map< MarketContext, string >(),
const boost::shared_ptr< ReferenceDataManager > &  referenceData = nullptr,
const IborFallbackConfig iborFallbackConfig = IborFallbackConfig::defaultConfig(),
const std::vector< boost::shared_ptr< EngineBuilder >>  extraEngineBuilders = {},
const bool  allowOverwrite = false 
)

Create an engine factory.

Parameters
dataConfiguration data
marketThe market that is passed to each builder
configurationsThe market configurations that are passed to each builder
referenceDatareference data
iborFallbackConfigibor fallback config
extraEngineBuildersadditional engine builders
allowOverwriteadditional engine builders may overwrite existing builders with same key

Member Function Documentation

◆ builder()

boost::shared_ptr<EngineBuilder> builder ( const string &  tradeType)

Get a builder by trade type.

This will look up configured model/engine for that trade type the returned builder can be cast to the type required for the tradeType.

The factory will call EngineBuilder::init() before returning it.