24#include <boost/make_shared.hpp>
29#include <ql/pricingengines/barrier/fdblackscholesbarrierengine.hpp>
30#include <ql/processes/blackscholesprocess.hpp>
52 virtual string keyImpl(
const Currency& forCcy,
const Currency& domCcy,
const Date& expiryDate,
53 const Date& paymentDate)
override {
58 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>
60 const string& ccyPairCode = forCcy.code() + domCcy.code();
61 Handle<BlackVolTermStructure> vol =
63 if (!timePoints.empty()) {
64 vol = Handle<BlackVolTermStructure>(
65 QuantLib::ext::make_shared<QuantExt::BlackMonotoneVarVolTermStructure>(vol, timePoints));
66 vol->enableExtrapolation();
68 return QuantLib::ext::make_shared<GeneralizedBlackScholesProcess>(
80 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const Currency& forCcy,
const Currency& domCcy,
81 const Date& expiryDate,
const Date& paymentDate)
override {
83 return QuantLib::ext::make_shared<QuantExt::AnalyticBarrierEngine>(gbsp, paymentDate);
92 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const Currency& forCcy,
const Currency& domCcy,
93 const Date& expiryDate,
const Date& paymentDate)
override {
95 Handle<YieldTermStructure> riskFreeRate =
97 Time expiry = riskFreeRate->dayCounter().yearFraction(riskFreeRate->referenceDate(),
98 std::max(riskFreeRate->referenceDate(), expiryDate));
106 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp;
112 std::vector<Time> timePoints(tGrid + 1);
113 Array timePointsArray(tGrid, expiry, -expiry / tGrid);
115 for (Size i = 0; i < tGrid; i++)
116 timePoints[timePoints.size() - i - 1] = timePointsArray[i];
117 timePoints.insert(std::upper_bound(timePoints.begin(), timePoints.end(), 0.99 / 365), 0.99 / 365);
122 return QuantLib::ext::make_shared<FdBlackScholesBarrierEngine>(gbsp, tGrid, xGrid, dampingSteps, scheme);
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.
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)
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const Currency &forCcy, const Currency &domCcy, const Date &expiryDate, const Date &paymentDate) override
FxBarrierOptionAnalyticEngineBuilder()
Engine Builder for European FX Barrier Options.
virtual string keyImpl(const Currency &forCcy, const Currency &domCcy, const Date &expiryDate, const Date &paymentDate) override
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > getBlackScholesProcess(const Currency &forCcy, const Currency &domCcy, const std::vector< Time > &timePoints={})
FxBarrierOptionEngineBuilder(const string &model, const string &engine)
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const Currency &forCcy, const Currency &domCcy, const Date &expiryDate, const Date &paymentDate) override
FxBarrierOptionFDEngineBuilder()
bool parseBool(const string &s)
Convert text to bool.
FdmSchemeDesc parseFdmSchemeDesc(const std::string &s)
Convert string to fdm scheme desc.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities