54 {},
55 const bool useFxSpot = true) {
56
59
61 Handle<BlackVolTermStructure> vol = this->
market_->equityVol(assetName, config);
62 if (!timePoints.empty()) {
63 vol = Handle<BlackVolTermStructure>(QuantLib::ext::make_shared<VVTS>(vol, timePoints));
64 vol->enableExtrapolation();
65 }
66 return QuantLib::ext::make_shared<QuantLib::GeneralizedBlackScholesProcess>(
67 this->
market_->equitySpot(assetName, config), this->market_->equityDividendCurve(assetName, config),
68 this->market_->equityForecastCurve(assetName, config), vol);
69
71 const string& ccyPairCode = assetName + ccy.code();
72 Handle<BlackVolTermStructure> vol = this->
market_->fxVol(ccyPairCode, config);
73 if (!timePoints.empty()) {
74 vol = Handle<BlackVolTermStructure>(QuantLib::ext::make_shared<VVTS>(vol, timePoints));
75 vol->enableExtrapolation();
76 }
77 if (useFxSpot) {
78 return QuantLib::ext::make_shared<QuantLib::GeneralizedBlackScholesProcess>(
79 this->
market_->fxSpot(ccyPairCode, config), this->market_->discountCurve(assetName, config),
80 this->market_->discountCurve(ccy.code(), config), vol);
81 }
82 return QuantLib::ext::make_shared<QuantLib::GeneralizedBlackScholesProcess>(
83 this->
market_->fxRate(ccyPairCode, config), this->market_->discountCurve(assetName, config),
84 this->market_->discountCurve(ccy.code(), config), vol);
85
86
88
89 Handle<BlackVolTermStructure> vol = this->
market_->commodityVolatility(assetName, config);
90 if (!timePoints.empty()) {
91 vol = Handle<BlackVolTermStructure>(QuantLib::ext::make_shared<VVTS>(vol, timePoints));
92 vol->enableExtrapolation();
93 }
94
95
96 Handle<QuantExt::PriceTermStructure> priceCurve = this->
market_->commodityPriceCurve(assetName, config);
97 Handle<Quote> commoditySpot(QuantLib::ext::make_shared<QuantExt::DerivedPriceQuote>(priceCurve));
98 Handle<YieldTermStructure> discount = this->
market_->discountCurve(ccy.code(), config);
99 Handle<YieldTermStructure> yield(
100 QuantLib::ext::make_shared<QuantExt::PriceTermStructureAdapter>(*priceCurve, *discount));
101 yield->enableExtrapolation();
102
103 return QuantLib::ext::make_shared<QuantLib::GeneralizedBlackScholesProcess>(commoditySpot, yield, discount, vol);
104
105 } else {
106 QL_FAIL("Asset class of " << (int)assetClassUnderlying << " not recognized.");
107 }
108 }
QuantLib::ext::shared_ptr< Market > market_
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)