26#include <boost/make_shared.hpp>
32#include <ql/processes/blackscholesprocess.hpp>
46 const Date&, const bool> {
54 virtual string keyImpl(
const Currency& forCcy,
const Currency& domCcy,
const string& type,
const Date& payDate,
55 const bool flipResults)
override {
56 return forCcy.code() + domCcy.code() + type +
ore::data::to_string(payDate) + (flipResults ?
"_1" :
"_0");
59 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const Currency& forCcy,
const Currency& domCcy,
60 const string& type,
const Date& payDate,
61 const bool flipResults)
override {
62 string pair = forCcy.code() + domCcy.code();
63 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp = QuantLib::ext::make_shared<GeneralizedBlackScholesProcess>(
65 market_->discountCurve(forCcy.code(),
70 if (type ==
"One-Touch") {
71 return QuantLib::ext::make_shared<QuantExt::AnalyticDigitalAmericanEngine>(gbsp, payDate, flipResults);
72 }
else if (type ==
"No-Touch") {
73 return QuantLib::ext::make_shared<QuantExt::AnalyticDigitalAmericanKOEngine>(gbsp, payDate, flipResults);
75 QL_FAIL(
"Unknown FX touch option type: " << type);
Abstract template engine builder class.
Abstract template EngineBuilder class that can cache engines and coupon pricers.
QuantLib::ext::shared_ptr< Market > market_
const string & engine() const
Return the engine name.
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)
Engine Builder for FX Touch Options.
virtual string keyImpl(const Currency &forCcy, const Currency &domCcy, const string &type, const Date &payDate, const bool flipResults) override
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const Currency &forCcy, const Currency &domCcy, const string &type, const Date &payDate, const bool flipResults) override
FxTouchOptionEngineBuilder()
FxTouchOptionEngineBuilder(const string &model, const string &engine)
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities