Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CamAmcSwapEngineBuilder Class Reference

Implementation of SwapEngineBuilderBase using MC pricer for external cam / AMC. More...

#include <ored/portfolio/builders/swap.hpp>

+ Inheritance diagram for CamAmcSwapEngineBuilder:
+ Collaboration diagram for CamAmcSwapEngineBuilder:

Public Member Functions

 CamAmcSwapEngineBuilder (const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > &cam, const std::vector< Date > &simulationDates)
 
- Public Member Functions inherited from SwapEngineBuilderBase
 SwapEngineBuilderBase (const std::string &model, const std::string &engine)
 
- Public Member Functions inherited from CachingEngineBuilder< T, U, Args >
 CachingEngineBuilder (const string &model, const string &engine, const set< string > &tradeTypes)
 
QuantLib::ext::shared_ptr< U > engine (Args... params)
 Return a PricingEngine or a FloatingRateCouponPricer. More...
 
void reset () override
 reset the builder (e.g. clear cache) More...
 
- Public Member Functions inherited from EngineBuilder
 EngineBuilder (const string &model, const string &engine, const set< string > &tradeTypes)
 
virtual ~EngineBuilder ()
 Virtual destructor. More...
 
const string & model () const
 Return the model name. More...
 
const string & engine () const
 Return the engine name. More...
 
const set< string > & tradeTypes () const
 Return the possible trade types. More...
 
const string & configuration (const MarketContext &key)
 Return a configuration (or the default one if key not found) More...
 
virtual void reset ()
 reset the builder (e.g. clear cache) More...
 
void init (const QuantLib::ext::shared_ptr< Market > market, const map< MarketContext, string > &configurations, const map< string, string > &modelParameters, const map< string, string > &engineParameters, const std::map< std::string, std::string > &globalParameters={})
 Initialise this Builder with the market and parameters to use. More...
 
const set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > & modelBuilders () const
 return model builders More...
 
std::string engineParameter (const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
 
std::string modelParameter (const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
 

Protected Member Functions

virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl (const Currency &ccy, const std::string &discountCurve, const std::string &securitySpread) override
 
- Protected Member Functions inherited from SwapEngineBuilderBase
virtual string keyImpl (const Currency &ccy, const std::string &discountCurve, const std::string &securitySpread) override
 
- Protected Member Functions inherited from CachingEngineBuilder< T, U, Args >
virtual T keyImpl (Args...)=0
 
virtual QuantLib::ext::shared_ptr< U > engineImpl (Args...)=0
 

Private Member Functions

QuantLib::ext::shared_ptr< PricingEngine > buildMcEngine (const QuantLib::ext::shared_ptr< QuantExt::LGM > &lgm, const Handle< YieldTermStructure > &discountCurve, const std::vector< Date > &simulationDates, const std::vector< Size > &externalModelIndices)
 

Private Attributes

const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModelcam_
 
const std::vector< Date > simulationDates_
 

Additional Inherited Members

- Protected Attributes inherited from CachingEngineBuilder< T, U, Args >
map< T, QuantLib::ext::shared_ptr< U > > engines_
 
- Protected Attributes inherited from EngineBuilder
string model_
 
string engine_
 
set< string > tradeTypes_
 
QuantLib::ext::shared_ptr< Marketmarket_
 
map< MarketContext, string > configurations_
 
map< string, string > modelParameters_
 
map< string, string > engineParameters_
 
std::map< std::string, std::string > globalParameters_
 
set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > modelBuilders_
 

Detailed Description

Implementation of SwapEngineBuilderBase using MC pricer for external cam / AMC.

Definition at line 153 of file swap.hpp.

Constructor & Destructor Documentation

◆ CamAmcSwapEngineBuilder()

CamAmcSwapEngineBuilder ( const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > &  cam,
const std::vector< Date > &  simulationDates 
)

Definition at line 155 of file swap.hpp.

157 : SwapEngineBuilderBase("CrossAssetModel", "AMC"), cam_(cam), simulationDates_(simulationDates) {}
const std::vector< Date > simulationDates_
Definition: swap.hpp:170
const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > cam_
Definition: swap.hpp:169
SwapEngineBuilderBase(const std::string &model, const std::string &engine)
Definition: swap.hpp:51

Member Function Documentation

◆ engineImpl()

QuantLib::ext::shared_ptr< PricingEngine > engineImpl ( const Currency &  ccy,
const std::string &  discountCurve,
const std::string &  securitySpread 
)
overrideprotectedvirtual

Definition at line 52 of file swap.cpp.

54 {
55 DLOG("Building AMC Swap engine for ccy " << ccy << " (from externally given CAM)");
56
57 QL_REQUIRE(cam_ != nullptr, "LgmAmcSwapEngineBuilder::engineImpl: cam is null");
58 Size currIdx = cam_->ccyIndex(ccy);
59 auto lgm = cam_->lgm(currIdx);
60 std::vector<Size> modelIndex(1, cam_->pIdx(CrossAssetModel::AssetType::IR, currIdx));
61
62 // we assume that the given cam has pricing discount curves attached already
63 Handle<YieldTermStructure> discountCurve;
64 return buildMcEngine(lgm, discountCurve, simulationDates_, modelIndex);
65}
QuantLib::ext::shared_ptr< PricingEngine > buildMcEngine(const QuantLib::ext::shared_ptr< QuantExt::LGM > &lgm, const Handle< YieldTermStructure > &discountCurve, const std::vector< Date > &simulationDates, const std::vector< Size > &externalModelIndices)
Definition: swap.cpp:34
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
+ Here is the call graph for this function:

◆ buildMcEngine()

QuantLib::ext::shared_ptr< PricingEngine > buildMcEngine ( const QuantLib::ext::shared_ptr< QuantExt::LGM > &  lgm,
const Handle< YieldTermStructure > &  discountCurve,
const std::vector< Date > &  simulationDates,
const std::vector< Size > &  externalModelIndices 
)
private

Definition at line 34 of file swap.cpp.

37 {
38
39 return QuantLib::ext::make_shared<QuantExt::McLgmSwapEngine>(
40 lgm, parseSequenceType(engineParameter("Training.Sequence")),
41 parseSequenceType(engineParameter("Pricing.Sequence")), parseInteger(engineParameter("Training.Samples")),
42 parseInteger(engineParameter("Pricing.Samples")), parseInteger(engineParameter("Training.Seed")),
43 parseInteger(engineParameter("Pricing.Seed")), parseInteger(engineParameter("Training.BasisFunctionOrder")),
44 parsePolynomType(engineParameter("Training.BasisFunction")),
46 parseSobolRsgDirectionIntegers(engineParameter("SobolDirectionIntegers")), discountCurve, simulationDates,
47 externalModelIndices, parseBool(engineParameter("MinObsDate")),
48 parseRegressorModel(engineParameter("RegressorModel", {}, false, "Simple")),
49 parseRealOrNull(engineParameter("RegressionVarianceCutoff", {}, false, std::string())));
50}
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
SequenceType parseSequenceType(const std::string &s)
Convert string to sequence type.
Definition: parsers.cpp:668
QuantLib::LsmBasisSystem::PolynomialType parsePolynomType(const std::string &s)
Convert text to QuantLib::LsmBasisSystem::PolynomialType.
Definition: parsers.cpp:527
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
SobolRsg::DirectionIntegers parseSobolRsgDirectionIntegers(const std::string &s)
Convert text to QuantLib::SobolRsg::DirectionIntegers.
Definition: parsers.cpp:579
Real parseRealOrNull(const string &s)
Convert text to Real, empty string to Null<Real>()
Definition: parsers.cpp:120
QuantExt::McMultiLegBaseEngine::RegressorModel parseRegressorModel(const std::string &s)
Convert text to QuantExt::McMultiLegBaseEngine::RegressorModel.
Definition: parsers.cpp:1418
SobolBrownianGenerator::Ordering parseSobolBrownianGeneratorOrdering(const std::string &s)
Convert text to QuantLib::SobolBrownianGenerator::Ordering.
Definition: parsers.cpp:567
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cam_

const QuantLib::ext::shared_ptr<QuantExt::CrossAssetModel> cam_
private

Definition at line 169 of file swap.hpp.

◆ simulationDates_

const std::vector<Date> simulationDates_
private

Definition at line 170 of file swap.hpp.