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< EngineData > | engineData () 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 IborFallbackConfig & | iborFallbackConfig () const |
Return the ibor fallback config. | |
boost::shared_ptr< EngineBuilder > | builder (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< LegBuilder > | legBuilder (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 | |
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.
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.
data | Configuration data |
market | The market that is passed to each builder |
configurations | The market configurations that are passed to each builder |
referenceData | reference data |
iborFallbackConfig | ibor fallback config |
extraEngineBuilders | additional engine builders |
allowOverwrite | additional engine builders may overwrite existing builders with same key |
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.