33#include <boost/make_shared.hpp>
45 const QuantLib::ext::shared_ptr<QuantExt::CommodityAveragePriceOption>&> {
52 std::string
keyImpl(
const Currency& ccy,
const string&
name,
const string&
id,
53 const QuantLib::ext::shared_ptr<QuantExt::CommodityAveragePriceOption>&)
override {
69 QuantLib::ext::shared_ptr<QuantLib::PricingEngine>
71 const QuantLib::ext::shared_ptr<QuantExt::CommodityAveragePriceOption>& apo)
override {
73 Handle<QuantLib::BlackVolTermStructure> vol =
83 <<
", using default value " << beta);
86 bool dontCalibrate =
false;
91 auto modelBuilder = QuantLib::ext::make_shared<CommodityApoModelBuilder>(yts, vol, apo, dontCalibrate);
94 return QuantLib::ext::make_shared<QuantExt::CommodityAveragePriceOptionAnalyticalEngine>(yts, modelBuilder->model(),
108 {
"CommodityAveragePriceOption",
"CommodityAveragePriceBarrierOption"}) {}
111 QuantLib::ext::shared_ptr<QuantLib::PricingEngine>
113 const QuantLib::ext::shared_ptr<QuantExt::CommodityAveragePriceOption>& apo)
override {
115 Handle<QuantLib::BlackVolTermStructure> vol =
119 Size samples = 10000;
125 <<
", using default value " << samples);
134 <<
", using default value " << beta);
137 bool dontCalibrate =
false;
142 auto modelBuilder = QuantLib::ext::make_shared<CommodityApoModelBuilder>(yts, vol, apo, dontCalibrate);
145 return QuantLib::ext::make_shared<QuantExt::CommodityAveragePriceOptionMonteCarloEngine>(yts, modelBuilder->model(),
Abstract template engine builder class.
Abstract template EngineBuilder class that can cache engines and coupon pricers.
Analytical Engine builder for Commodity Average Price Options.
CommodityApoAnalyticalEngineBuilder()
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engineImpl(const Currency &ccy, const string &name, const string &id, const QuantLib::ext::shared_ptr< QuantExt::CommodityAveragePriceOption > &apo) override
Engine builder base class for Commodity Average Price Options.
CommodityApoBaseEngineBuilder(const std::string &model, const std::string &engine, const std::set< std::string > &tradeTypes)
std::string keyImpl(const Currency &ccy, const string &name, const string &id, const QuantLib::ext::shared_ptr< QuantExt::CommodityAveragePriceOption > &) override
Monte Carlo Engine builder for Commodity Average Price Options.
CommodityApoMonteCarloEngineBuilder()
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engineImpl(const Currency &ccy, const string &name, const string &id, const QuantLib::ext::shared_ptr< QuantExt::CommodityAveragePriceOption > &apo) override
QuantLib::ext::shared_ptr< Market > market_
const string & engine() const
Return the engine name.
const set< string > & tradeTypes() const
Return the possible trade types.
map< string, string > engineParameters_
const string & model() const
Return the model name.
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > modelBuilders_
std::map< std::string, std::string > globalParameters_
model builder for commodityapos
bool parseBool(const string &s)
Convert text to bool.
Real parseReal(const string &s)
Convert text to Real.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
#define ALOG(text)
Logging Macro (Level = Alert)
Serializable Credit Default Swap.