24#include <boost/make_shared.hpp>
29#include <ql/pricingengines/barrier/analyticbarrierengine.hpp>
30#include <ql/pricingengines/barrier/fdblackscholesbarrierengine.hpp>
31#include <ql/processes/blackscholesprocess.hpp>
51 virtual string keyImpl(
const string& assetName,
const Currency& ccy,
const Date& expiryDate)
override {
55 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>
getBlackScholesProcess(
const string& assetName,
const Currency& ccy,
56 const std::vector<Time>& timePoints = {}) {
59 if (!timePoints.empty()) {
60 vol = Handle<BlackVolTermStructure>(
61 QuantLib::ext::make_shared<QuantExt::BlackMonotoneVarVolTermStructure>(vol, timePoints));
62 vol->enableExtrapolation();
64 return QuantLib::ext::make_shared<GeneralizedBlackScholesProcess>(
80 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
const Date& expiryDate)
override {
82 return QuantLib::ext::make_shared<QuantLib::AnalyticBarrierEngine>(gbsp);
95 virtual QuantLib::ext::shared_ptr<PricingEngine>
engineImpl(
const string& assetName,
const Currency& ccy,
const Date& expiryDate)
override {
97 Handle<YieldTermStructure> riskFreeRate =
99 Time expiry = riskFreeRate->dayCounter().yearFraction(riskFreeRate->referenceDate(),
100 std::max(riskFreeRate->referenceDate(), expiryDate));
108 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp;
114 std::vector<Time> timePoints(tGrid + 1);
115 Array timePointsArray(tGrid, expiry, -expiry / tGrid);
117 for(Size i = 0; i < tGrid; i++)
118 timePoints[timePoints.size() - i - 1] = timePointsArray[i];
119 timePoints.insert(std::upper_bound(timePoints.begin(), timePoints.end(), 0.99 / 365), 0.99 / 365);
124 return QuantLib::ext::make_shared<FdBlackScholesBarrierEngine>(gbsp, tGrid, xGrid,
125 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 string &assetName, const Currency &ccy, const Date &expiryDate) override
EquityBarrierOptionAnalyticEngineBuilder()
Engine Builder for Equity Barrier Options.
EquityBarrierOptionEngineBuilder(const string &model, const string &engine)
virtual string keyImpl(const string &assetName, const Currency &ccy, const Date &expiryDate) override
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > getBlackScholesProcess(const string &assetName, const Currency &ccy, const std::vector< Time > &timePoints={})
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &assetName, const Currency &ccy, const Date &expiryDate) override
EquityBarrierOptionFDEngineBuilder()
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