20#include <qle/pricingengines/numericlgmbgsflexiswapengine.hpp>
22#include <ql/quotes/compositequote.hpp>
27QuantLib::ext::shared_ptr<PricingEngine>
29 const std::vector<Date>& expiries,
const Date&
maturity,
30 const std::vector<Real>& strikes) {
31 DLOG(
"Building LGM Grid BGS Flexi Swap engine for trade " <<
id);
35 DLOG(
"Get engine data");
40 QuantExt::NumericLgmFlexiSwapEngine::Method method;
42 method = QuantExt::NumericLgmFlexiSwapEngine::Method::SingleSwaptions;
44 method = QuantExt::NumericLgmFlexiSwapEngine::Method::SwaptionArray;
46 method = QuantExt::NumericLgmFlexiSwapEngine::Method::Automatic;
48 QL_FAIL(
"FlexiSwap engine parameter method (" <<
engineParameter(
"method") <<
") not recognised");
52 Handle<Quote> minCprMult(QuantLib::ext::make_shared<SimpleQuote>(
parseReal(
modelParameter(
"MinCPRMultiplier"))));
53 Handle<Quote> maxCprMult(QuantLib::ext::make_shared<SimpleQuote>(
parseReal(
modelParameter(
"MaxCPRMultiplier"))));
57 QuantLib::ext::make_shared<CompositeQuote<std::multiplies<Real>>>(minCprMult, cpr, std::multiplies<Real>()));
59 QuantLib::ext::make_shared<CompositeQuote<std::multiplies<Real>>>(maxCprMult, cpr, std::multiplies<Real>()));
64 return QuantLib::ext::make_shared<QuantExt::NumericLgmBgsFlexiSwapEngine>(lgm, sy, ny, sx, nx, minCpr, maxCpr, dscCurve,
65 method, singleSwaptionThreshold);
virtual QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engineImpl(const std::string &id, const std::string &id2, const std::string &ccy, const std::vector< QuantLib::Date > &dates, const QuantLib::Date &maturity, const std::vector< QuantLib::Real > &strikes) override
QuantLib::ext::shared_ptr< Market > market_
const string & model() const
Return the model name.
std::string modelParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
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)
Real parseReal(const string &s)
Convert text to Real.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
#define DLOG(text)
Logging Macro (Level = Debug)
Serializable Credit Default Swap.