Pricing Engine Factory class. More...
#include <ored/portfolio/enginefactory.hpp>
Public Member Functions | |
EngineFactory (const QuantLib::ext::shared_ptr< EngineData > &data, const QuantLib::ext::shared_ptr< Market > &market, const map< MarketContext, string > &configurations=std::map< MarketContext, string >(), const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceData=nullptr, const IborFallbackConfig &iborFallbackConfig=IborFallbackConfig::defaultConfig(), const std::vector< QuantLib::ext::shared_ptr< EngineBuilder > > extraEngineBuilders={}, const bool allowOverwrite=false) | |
Create an engine factory. More... | |
const QuantLib::ext::shared_ptr< Market > & | market () const |
Return the market used by this EngineFactory. More... | |
const map< MarketContext, string > & | configurations () const |
Return the market configurations used by this EngineFactory. More... | |
const string & | configuration (const MarketContext &key) |
Return a configuration (or the default one if key not found) More... | |
const QuantLib::ext::shared_ptr< EngineData > | engineData () const |
Return the EngineData parameters. More... | |
void | registerBuilder (const QuantLib::ext::shared_ptr< EngineBuilder > &builder, const bool allowOverwrite=false) |
Register a builder with the factory. More... | |
const QuantLib::ext::shared_ptr< ReferenceDataManager > & | referenceData () const |
Return the reference data used by this EngineFactory. More... | |
const IborFallbackConfig & | iborFallbackConfig () const |
Return the ibor fallback config. More... | |
QuantLib::ext::shared_ptr< EngineBuilder > | builder (const string &tradeType) |
Get a builder by trade type. More... | |
void | registerLegBuilder (const QuantLib::ext::shared_ptr< LegBuilder > &legBuilder, const bool allowOverwrite=false) |
Register a leg builder with the factory. More... | |
QuantLib::ext::shared_ptr< LegBuilder > | legBuilder (const string &legType) |
Get a leg builder by leg type. More... | |
void | addDefaultBuilders () |
Add a set of default engine and leg builders. More... | |
void | addExtraBuilders (const std::vector< QuantLib::ext::shared_ptr< EngineBuilder > > extraEngineBuilders, const std::vector< QuantLib::ext::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. More... | |
void | clear () |
Clear all builders. More... | |
set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > | modelBuilders () const |
return model builders More... | |
Private Attributes | |
QuantLib::ext::shared_ptr< Market > | market_ |
QuantLib::ext::shared_ptr< EngineData > | engineData_ |
map< MarketContext, string > | configurations_ |
map< tuple< string, string, set< string > >, QuantLib::ext::shared_ptr< EngineBuilder > > | builders_ |
map< string, QuantLib::ext::shared_ptr< LegBuilder > > | legBuilders_ |
QuantLib::ext::shared_ptr< ReferenceDataManager > | referenceData_ |
IborFallbackConfig | iborFallbackConfig_ |
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.
Definition at line 224 of file enginefactory.hpp.
EngineFactory | ( | const QuantLib::ext::shared_ptr< EngineData > & | data, |
const QuantLib::ext::shared_ptr< Market > & | market, | ||
const map< MarketContext, string > & | configurations = std::map<MarketContext, string>() , |
||
const QuantLib::ext::shared_ptr< ReferenceDataManager > & | referenceData = nullptr , |
||
const IborFallbackConfig & | iborFallbackConfig = IborFallbackConfig::defaultConfig() , |
||
const std::vector< QuantLib::ext::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 |
Definition at line 176 of file enginefactory.cpp.
const QuantLib::ext::shared_ptr< Market > & market | ( | ) | const |
const map< MarketContext, string > & configurations | ( | ) | const |
Return the market configurations used by this EngineFactory.
Definition at line 245 of file enginefactory.hpp.
const string & configuration | ( | const MarketContext & | key | ) |
Return a configuration (or the default one if key not found)
Definition at line 247 of file enginefactory.hpp.
const QuantLib::ext::shared_ptr< EngineData > engineData | ( | ) | const |
void registerBuilder | ( | const QuantLib::ext::shared_ptr< EngineBuilder > & | builder, |
const bool | allowOverwrite = false |
||
) |
Register a builder with the factory.
Definition at line 190 of file enginefactory.cpp.
const QuantLib::ext::shared_ptr< ReferenceDataManager > & referenceData | ( | ) | const |
Return the reference data used by this EngineFactory.
Definition at line 259 of file enginefactory.hpp.
const IborFallbackConfig & iborFallbackConfig | ( | ) | const |
QuantLib::ext::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.
Definition at line 202 of file enginefactory.cpp.
void registerLegBuilder | ( | const QuantLib::ext::shared_ptr< LegBuilder > & | legBuilder, |
const bool | allowOverwrite = false |
||
) |
Register a leg builder with the factory.
Definition at line 232 of file enginefactory.cpp.
QuantLib::ext::shared_ptr< LegBuilder > legBuilder | ( | const string & | legType | ) |
Get a leg builder by leg type.
Definition at line 240 of file enginefactory.cpp.
void addDefaultBuilders | ( | ) |
Add a set of default engine and leg builders.
Definition at line 254 of file enginefactory.cpp.
void addExtraBuilders | ( | const std::vector< QuantLib::ext::shared_ptr< EngineBuilder > > | extraEngineBuilders, |
const std::vector< QuantLib::ext::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.
Definition at line 261 of file enginefactory.cpp.
void clear | ( | ) |
Clear all builders.
Definition at line 285 of file enginefactory.hpp.
set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > modelBuilders | ( | ) | const |
return model builders
Definition at line 246 of file enginefactory.cpp.
|
private |
Definition at line 294 of file enginefactory.hpp.
|
private |
Definition at line 295 of file enginefactory.hpp.
|
private |
Definition at line 296 of file enginefactory.hpp.
|
private |
Definition at line 297 of file enginefactory.hpp.
|
private |
Definition at line 298 of file enginefactory.hpp.
|
private |
Definition at line 299 of file enginefactory.hpp.
|
private |
Definition at line 300 of file enginefactory.hpp.