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

Abstract Engine Builder for Quanto European Vanilla Options. More...

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

+ Inheritance diagram for QuantoEuropeanOptionEngineBuilder:
+ Collaboration diagram for QuantoEuropeanOptionEngineBuilder:

Public Member Functions

 QuantoEuropeanOptionEngineBuilder (const string &model, const set< string > &tradeTypes, const AssetClass &assetClass)
 
- Public Member Functions inherited from QuantoVanillaOptionEngineBuilder
 QuantoVanillaOptionEngineBuilder (const string &model, const string &engine, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)
 
QuantLib::ext::shared_ptr< PricingEngine > engine (const string &assetName, const Currency &underlyingCcy, const Currency &payCcy, const Date &expiryDate)
 
- Public Member Functions inherited from CachingOptionEngineBuilder< string, const string &, const Currency &, const Currency &, const AssetClass &, const Date & >
 CachingOptionEngineBuilder (const string &model, const string &engine, const set< string > &tradeTypes, const AssetClass &assetClass)
 
- 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 string &assetName, const Currency &underlyingCcy, const Currency &payCcy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
 
- Protected Member Functions inherited from QuantoVanillaOptionEngineBuilder
virtual string keyImpl (const string &assetName, const Currency &underlyingCcy, const Currency &payCcy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
 
- Protected Member Functions inherited from CachingOptionEngineBuilder< string, const string &, const Currency &, const Currency &, const AssetClass &, const Date & >
QuantLib::ext::shared_ptr< QuantLib::GeneralizedBlackScholesProcess > getBlackScholesProcess (const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const std::vector< Time > &timePoints={}, const bool useFxSpot=true)
 
- Protected Member Functions inherited from CachingEngineBuilder< T, U, Args >
virtual T keyImpl (Args...)=0
 
virtual QuantLib::ext::shared_ptr< U > engineImpl (Args...)=0
 

Additional Inherited Members

- Protected Attributes inherited from QuantoVanillaOptionEngineBuilder
Date expiryDate_
 
- Protected Attributes inherited from CachingOptionEngineBuilder< string, const string &, const Currency &, const Currency &, const AssetClass &, const Date & >
AssetClass assetClass_
 
- 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

Abstract Engine Builder for Quanto European Vanilla Options.

Pricing engines are cached by asset/currency

Definition at line 68 of file quantovanillaoption.hpp.

Constructor & Destructor Documentation

◆ QuantoEuropeanOptionEngineBuilder()

QuantoEuropeanOptionEngineBuilder ( const string &  model,
const set< string > &  tradeTypes,
const AssetClass assetClass 
)

Definition at line 70 of file quantovanillaoption.hpp.

71 : QuantoVanillaOptionEngineBuilder(model, "AnalyticEuropeanEngine", tradeTypes, assetClass, Date()) {}
const set< string > & tradeTypes() const
Return the possible trade types.
const string & model() const
Return the model name.
QuantoVanillaOptionEngineBuilder(const string &model, const string &engine, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)

Member Function Documentation

◆ engineImpl()

virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl ( const string &  assetName,
const Currency &  underlyingCcy,
const Currency &  payCcy,
const AssetClass assetClassUnderlying,
const Date &  expiryDate 
)
overrideprotectedvirtual

Definition at line 74 of file quantovanillaoption.hpp.

76 {
77 QuantLib::ext::shared_ptr<QuantLib::GeneralizedBlackScholesProcess> gbsp =
78 getBlackScholesProcess(assetName, underlyingCcy, assetClassUnderlying);
79
80 Handle<YieldTermStructure> discountCurve =
81 market_->discountCurve(underlyingCcy.code(), configuration(MarketContext::pricing));
82
83 Handle<BlackVolTermStructure> fxVolatility =
84 market_->fxVol(underlyingCcy.code() + payCcy.code(), configuration(MarketContext::pricing));
85
86 std::string fxSource = modelParameters_.at("FXSource");
87 std::string fxIndex = "FX-" + fxSource + "-" + underlyingCcy.code() + "-" + payCcy.code();
88 std::string underlyingIndex;
89 switch (assetClassUnderlying) {
90 case AssetClass::EQ:
91 underlyingIndex = "EQ-" + assetName;
92 break;
93 case AssetClass::COM:
94 underlyingIndex = "COMM-" + assetName;
95 break;
96 default:
97 QL_FAIL("Asset class " << assetClassUnderlying << " not supported for quanto vanilla option.");
98 }
99
100 QuantLib::Handle<QuantExt::CorrelationTermStructure> corrCurve(
101 QuantLib::ext::make_shared<QuantExt::FlatCorrelation>(0, NullCalendar(), 0.0, Actual365Fixed()));
102 try {
103 corrCurve = market_->correlationCurve(fxIndex, underlyingIndex, configuration(MarketContext::pricing));
104 } catch (...) {
105 WLOG("no correlation curve for " << fxIndex << ", " << underlyingIndex
106 << " found, fall back to zero correlation");
107 }
108
109 return QuantLib::ext::make_shared<QuantLib::QuantoEngine<VanillaOption, QuantLib::AnalyticEuropeanEngine>>(
110 gbsp, discountCurve, fxVolatility,
111 Handle<Quote>(
112 QuantLib::ext::make_shared<QuantExt::CorrelationValue>(corrCurve, corrCurve->timeFromReference(expiryDate))));
113 }
QuantLib::ext::shared_ptr< QuantLib::GeneralizedBlackScholesProcess > getBlackScholesProcess(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const std::vector< Time > &timePoints={}, const bool useFxSpot=true)
QuantLib::ext::shared_ptr< Market > market_
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
map< string, string > modelParameters_
#define WLOG(text)
Logging Macro (Level = Warning)
Definition: log.hpp:550
+ Here is the call graph for this function: