28#include <ql/cashflows/couponpricer.hpp>
29#include <ql/cashflows/inflationcouponpricer.hpp>
30#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
42 :
CachingEngineBuilder(
"CapFlooredNonStdYYModel",
"CapFlooredNonStdYYCouponPricer", {
"CapFlooredNonStdYYLeg"}) {
46 virtual string keyImpl(
const string& indexName)
override {
return indexName; }
47 virtual QuantLib::ext::shared_ptr<QuantLib::InflationCouponPricer>
engineImpl(
const string& indexName)
override {
48 QuantLib::ext::shared_ptr<YoYOptionletVolatilitySurface> vol =
51 Handle<YieldTermStructure> yts =
market_->discountCurve(index->currency().code());
52 if (vol->volatilityType() == VolatilityType::ShiftedLognormal && vol->displacement() == 0.0)
53 return QuantLib::ext::make_shared<QuantExt::NonStandardBlackYoYInflationCouponPricer>(
54 Handle<YoYOptionletVolatilitySurface>(vol), yts);
55 else if (vol->volatilityType() == VolatilityType::ShiftedLognormal && vol->displacement() != 0.0)
56 return QuantLib::ext::make_shared<QuantExt::NonStandardUnitDisplacedBlackYoYInflationCouponPricer>(
57 Handle<YoYOptionletVolatilitySurface>(vol), yts);
58 else if (vol->volatilityType() == VolatilityType::Normal)
59 return QuantLib::ext::make_shared<QuantExt::NonStandardBachelierYoYInflationCouponPricer>(
60 Handle<YoYOptionletVolatilitySurface>(vol), yts);
62 QL_FAIL(
"Unknown VolatilityType of YoYOptionletVolatilitySurface");
Abstract template engine builder class.
Abstract template EngineBuilder class that can cache engines and coupon pricers.
CouponPricer Builder for Capped/Floored YoY Inflation Leg.
CapFlooredNonStandardYoYLegEngineBuilder()
virtual QuantLib::ext::shared_ptr< QuantLib::InflationCouponPricer > engineImpl(const string &indexName) override
virtual string keyImpl(const string &indexName) override
QuantLib::ext::shared_ptr< Market > market_
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
Serializable Credit Default Swap.