26 #include <boost/make_shared.hpp>
32 #include <ql/pricingengines/asian/analytic_cont_geom_av_price.hpp>
33 #include <ql/pricingengines/asian/analytic_discr_geom_av_price.hpp>
34 #include <ql/pricingengines/asian/analytic_discr_geom_av_strike.hpp>
35 #include <ql/pricingengines/asian/mc_discr_arith_av_price.hpp>
36 #include <ql/pricingengines/asian/mc_discr_arith_av_strike.hpp>
37 #include <ql/pricingengines/asian/turnbullwakemanasianengine.hpp>
38 #include <ql/utilities/null.hpp>
54 const AssetClass& assetClass,
const Date& expiryDate)
57 QuantLib::ext::shared_ptr<PricingEngine>
engine(
const string& assetName,
const Currency& ccy,
const Date& expiryDate) {
62 QuantLib::ext::shared_ptr<PricingEngine>
engine(
const Currency& ccy1,
const Currency& ccy2,
const Date& expiryDate) {
71 virtual string keyImpl(
const string& assetName,
const Currency& ccy,
const AssetClass& assetClassUnderlying,
72 const Date& expiryDate)
override {
73 return assetName +
"/" + ccy.code() +
"/" +
to_string(expiryDate);
87 const AssetClass& assetClass,
const Date& expiryDate)
93 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
95 const Date& expiryDate)
override {
105 if (requiredSamples == 0)
106 requiredSamples = Null<Size>();
107 if (requiredTolerance == 0)
108 requiredTolerance = Null<Real>();
110 maxSamples = Null<Size>();
111 QL_REQUIRE(requiredSamples != QuantLib::Null<Size>() || requiredTolerance != QuantLib::Null<Real>(),
112 "RequiredSamples or RequiredTolerance must be set for engine MCDiscreteArithmeticAPEngine.");
114 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
116 return QuantLib::ext::make_shared<MCDiscreteArithmeticAPEngine<LowDiscrepancy>>(gbsp, brownianBridge, antitheticVariate,
117 controlVariate, requiredSamples,
118 requiredTolerance, maxSamples, seed);
130 const AssetClass& assetClass,
const Date& expiryDate)
136 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
138 const Date& expiryDate)
override {
147 if (requiredSamples == 0)
148 requiredSamples = Null<Size>();
149 if (requiredTolerance == 0)
150 requiredTolerance = Null<Real>();
152 maxSamples = Null<Size>();
153 QL_REQUIRE(requiredSamples != QuantLib::Null<Size>() || requiredTolerance != QuantLib::Null<Real>(),
154 "RequiredSamples or RequiredTolerance must be set for engine MCDiscreteArithmeticASEngine.");
156 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
158 return QuantLib::ext::make_shared<MCDiscreteArithmeticASEngine<LowDiscrepancy>>(
159 gbsp, brownianBridge, antitheticVariate, requiredSamples, requiredTolerance, maxSamples, seed);
171 const AssetClass& assetClass,
const Date& expiryDate)
177 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
179 const Date& expiryDate)
override {
188 if (requiredSamples == 0)
189 requiredSamples = Null<Size>();
190 if (requiredTolerance == 0)
191 requiredTolerance = Null<Real>();
193 maxSamples = Null<Size>();
194 QL_REQUIRE(requiredSamples != QuantLib::Null<Size>() || requiredTolerance != QuantLib::Null<Real>(),
195 "RequiredSamples or RequiredTolerance must be set for engine MCDiscreteGeometricAPEngine.");
197 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
199 return QuantLib::ext::make_shared<MCDiscreteGeometricAPEngine<LowDiscrepancy>>(
200 gbsp, brownianBridge, antitheticVariate, requiredSamples, requiredTolerance, maxSamples, seed);
217 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
219 const Date& expiryDate)
override {
220 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
222 return QuantLib::ext::make_shared<AnalyticDiscreteGeometricAveragePriceAsianEngine>(gbsp);
239 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
241 const Date& expiryDate)
override {
242 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
244 return QuantLib::ext::make_shared<AnalyticDiscreteGeometricAverageStrikeAsianEngine>(gbsp);
262 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
264 const Date& expiryDate)
override {
265 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
267 return QuantLib::ext::make_shared<AnalyticContinuousGeometricAveragePriceAsianEngine>(gbsp);
284 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
286 const Date& expiryDate)
override {
287 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp =
289 return QuantLib::ext::make_shared<TurnbullWakemanAsianEngine>(gbsp);
297 {
"EquityAsianOptionArithmeticPrice",
"EquityAsianOptionArithmeticStrike",
298 "EquityAsianOptionGeometricPrice",
"EquityAsianOptionGeometricStrike",
299 "FxAsianOptionArithmeticPrice",
"FxAsianOptionArithmeticStrike",
300 "FxAsianOptionGeometricPrice",
"FxAsianOptionGeometricStrike",
301 "CommodityAsianOptionArithmeticPrice",
"CommodityAsianOptionArithmeticStrike",
302 "CommodityAsianOptionGeometricPrice",
"CommodityAsianOptionGeometricStrike"}) {}
303 QuantLib::ext::shared_ptr<ore::data::Trade>
build(
const Trade* trade,
304 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory)
override;
basket option wrapper for scripted trade
Abstract engine builders for European and American Options.
Abstract template engine builder class.
Abstract Engine Builder for Asian Options.
QuantLib::ext::shared_ptr< PricingEngine > engine(const Currency &ccy1, const Currency &ccy2, const Date &expiryDate)
AsianOptionEngineBuilder(const string &model, const string &engine, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)
virtual string keyImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
QuantLib::ext::shared_ptr< PricingEngine > engine(const string &assetName, const Currency &ccy, const Date &expiryDate)
virtual std::string processType()
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
AsianOptionScriptedEngineBuilder()
QuantLib::ext::shared_ptr< ore::data::Trade > build(const Trade *trade, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory) override
std::string effectiveTradeType() const override
Abstract template EngineBuilder class that can cache engines and coupon pricers.
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)
Delegating Engine Builder.
const string & engine() const
Return the engine name.
const set< string > & tradeTypes() const
Return the possible trade types.
const string & model() const
Return the model name.
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
Continuous Analytic Engine Builder for European Asian Geometric Average Price Options.
EuropeanAsianOptionACGAPEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass)
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
Discrete Analytic Engine Builder for European Asian Geometric Average Price Options.
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
EuropeanAsianOptionADGAPEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass)
Discrete Analytic Engine Builder for European Asian Geometric Average Strike Options.
EuropeanAsianOptionADGASEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass)
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
Discrete Monte Carlo Engine Builder for European Asian Arithmetic Average Price Options.
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
EuropeanAsianOptionMCDAAPEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)
Discrete Monte Carlo Engine Builder for European Asian Arithmetic Average Strike Options.
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
EuropeanAsianOptionMCDAASEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
Discrete Monte Carlo Engine Builder for European Asian Geometric Average Price Options.
EuropeanAsianOptionMCDGAPEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass, const Date &expiryDate)
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
Discrete Analytic TW Engine Builder for European Asian Arithmetic Average Price Options.
EuropeanAsianOptionTWEngineBuilder(const string &model, const set< string > &tradeTypes, const AssetClass &assetClass)
std::string processType() override
This is used in building the option to select between Discrete- and ContinuousAveragingAsianOption.
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const Date &expiryDate) override
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.
Map text representations to QuantLib/QuantExt types.
Classes and functions for log message handling.
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities