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

CouponPricer Builder for CmsSpreadLeg. More...

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

+ Inheritance diagram for CmsSpreadCouponPricerBuilder:
+ Collaboration diagram for CmsSpreadCouponPricerBuilder:

Public Member Functions

 CmsSpreadCouponPricerBuilder ()
 
- 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

string keyImpl (const Currency &ccy, const string &index1, const string &index2, const QuantLib::ext::shared_ptr< QuantLib::CmsCouponPricer > &cmsPricer) override
 
QuantLib::ext::shared_ptr< FloatingRateCouponPricerengineImpl (const Currency &ccy, const string &index1, const string &index2, const QuantLib::ext::shared_ptr< QuantLib::CmsCouponPricer > &cmsPricer) override
 
- 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 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

CouponPricer Builder for CmsSpreadLeg.

The coupon pricers are cached by currency

Definition at line 41 of file cmsspread.hpp.

Constructor & Destructor Documentation

◆ CmsSpreadCouponPricerBuilder()

Definition at line 45 of file cmsspread.hpp.

45: CachingEngineBuilder("BrigoMercurio", "Analytic", {"CMSSpread"}) {}
CachingEngineBuilder(const string &model, const string &engine, const set< string > &tradeTypes)

Member Function Documentation

◆ keyImpl()

string keyImpl ( const Currency &  ccy,
const string &  index1,
const string &  index2,
const QuantLib::ext::shared_ptr< QuantLib::CmsCouponPricer > &  cmsPricer 
)
overrideprotected

Definition at line 48 of file cmsspread.hpp.

49 {
50
51 return index1 + ":" + index2;
52 }

◆ engineImpl()

QuantLib::ext::shared_ptr< FloatingRateCouponPricer > engineImpl ( const Currency &  ccy,
const string &  index1,
const string &  index2,
const QuantLib::ext::shared_ptr< QuantLib::CmsCouponPricer > &  cmsPricer 
)
overrideprotected

Definition at line 32 of file cmsspread.cpp.

33 {
34
35 QuantLib::Handle<QuantExt::CorrelationTermStructure> corrCurve(
36 QuantLib::ext::make_shared<QuantExt::FlatCorrelation>(0, NullCalendar(), 0.0, Actual365Fixed()));
37 try {
38 corrCurve = market_->correlationCurve(index1, index2, configuration(MarketContext::pricing));
39 } catch (...) {
40 WLOG("no correlation curve for " << index1 << ", " << index2 << " found, fall back to zero correlation.");
41 }
42
43 const string& ccyCode = ccy.code();
44 return QuantLib::ext::make_shared<QuantExt::LognormalCmsSpreadPricer>(
45 cmsPricer, corrCurve, market_->discountCurve(ccyCode, configuration(MarketContext::pricing)),
46 parseInteger(engineParameter("IntegrationPoints")));
47}
QuantLib::ext::shared_ptr< Market > market_
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
#define WLOG(text)
Logging Macro (Level = Warning)
Definition: log.hpp:550
+ Here is the call graph for this function: