28#include <ql/cashflows/couponpricer.hpp>
29#include <ql/cashflows/inflationcouponpricer.hpp>
30#include <ql/indexes/inflationindex.hpp>
31#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
45 virtual string keyImpl(
const string& indexName)
override {
return indexName; }
46 virtual QuantLib::ext::shared_ptr<QuantLib::InflationCouponPricer>
engineImpl(
const string& indexName)
override {
47 QuantLib::ext::shared_ptr<YoYOptionletVolatilitySurface> vol =
50 Handle<YieldTermStructure> yts =
market_->discountCurve(index->currency().code());
51 if (vol->volatilityType() == VolatilityType::ShiftedLognormal && vol->displacement() == 0.0)
52 return QuantLib::ext::make_shared<BlackYoYInflationCouponPricer>(Handle<YoYOptionletVolatilitySurface>(vol), yts);
53 else if (vol->volatilityType() == VolatilityType::ShiftedLognormal && vol->displacement() != 0.0)
54 return QuantLib::ext::make_shared<UnitDisplacedBlackYoYInflationCouponPricer>(
55 Handle<YoYOptionletVolatilitySurface>(vol), yts);
56 else if (vol->volatilityType() == VolatilityType::Normal)
57 return QuantLib::ext::make_shared<BachelierYoYInflationCouponPricer>(Handle<YoYOptionletVolatilitySurface>(vol),
60 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.
CapFlooredYoYLegEngineBuilder()
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.