23using QuantLib::Option;
31 : YoYInflationCouponPricer(model->irlgm1f(model->ccyIndex(model->infjy(index)->currency()))->termStructure()),
32 model_(model), index_(index) {
35 nominalTermStructure_ =
model_->irlgm1f(irIdx)->termStructure();
38 registerWith(nominalTermStructure_);
42 QL_FAIL(
"JyYoYInflationCouponPricer::optionletRate: not implemented.");
53 Date numFixingDate = coupon_->fixingDate();
56 Date denFixingDate = numFixingDate - 1 * Years;
60 Date today = Settings::instance().evaluationDate();
61 const auto& index = coupon_->yoyIndex();
62 auto freq = index->frequency();
63 auto ip = inflationPeriod(today - index->availabilityLag(), freq);
64 bool isInterp = index->interpolated();
65 if ((!isInterp && denFixingDate < ip.first) || (isInterp && denFixingDate < ip.first - Period(freq))) {
66 return coupon_->indexFixing();
70 auto zts =
model_->infjy(
index_)->realRate()->termStructure();
71 auto S =
inflationTime(denFixingDate, *zts, index->interpolated());
72 auto T =
inflationTime(numFixingDate, *zts, index->interpolated());
77Real
jyExpectedIndexRatio(
const QuantLib::ext::shared_ptr<CrossAssetModel>& model, Size index, Time S, Time T,
78 bool indexIsInterpolated) {
80 using namespace CrossAssetAnalytics;
81 auto irIdx = model->ccyIndex(model->infjy(index)->currency());
82 auto irTs = model->irlgm1f(irIdx)->termStructure();
83 auto zts = model->infjy(index)->realRate()->termStructure();
89 auto rrParam = model->infjy(index)->realRate();
90 auto H_r_S = rrParam->H(S);
91 auto H_r_T = rrParam->H(T);
92 auto H_n_S = model->irlgm1f(irIdx)->H(S);
94 auto c = H_r_S * rrParam->zeta(S);
95 c -= H_n_S *
integral(*model,
P(
rzy(irIdx, index, 0),
az(irIdx),
ay(index)), 0.0, S);
97 LC(0.0, -1.0,
P(
ay(index),
ay(index),
Hy(index)), 1.0,
98 P(
rzy(irIdx, index, 0),
az(irIdx),
ay(index),
Hz(irIdx)), -1.0,
99 P(
ryy(index, index, 0, 1),
ay(index),
sy(index))),
101 c *= (H_r_S - H_r_T);
103 return growthRatio *
exp(c);
JyYoYInflationCouponPricer(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, QuantLib::Size index)
QuantLib::ext::shared_ptr< CrossAssetModel > model_
QuantLib::Rate adjustedFixing(QuantLib::Rate fixing=QuantLib::Null< QuantLib::Rate >()) const override
QuantLib::Real optionletRate(QuantLib::Option::Type optionType, QuantLib::Real effStrike) const override
analytics for the cross asset model
const LC1_< E1 > LC(QuantLib::Real c, QuantLib::Real c1, const E1 &e1)
Real integral(const CrossAssetModel &model, const E &e, const Real a, const Real b)
const P2_< E1, E2 > P(const E1 &e1, const E2 &e2)
some inflation related utilities.
Jarrow Yildrim (JY) pricer for capped or floored year on year (YoY) inflation coupons.
Real jyExpectedIndexRatio(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, Size index, Time S, Time T, bool indexIsInterpolated)
CompiledFormula exp(CompiledFormula x)
Time inflationTime(const Date &date, const QuantLib::ext::shared_ptr< InflationTermStructure > &inflationTs, bool indexIsInterpolated, const DayCounter &dayCounter)
Real inflationGrowth(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, Size index, Time S, Time T, Real irState, Real rrState, bool indexIsInterpolated)
INF H component. May relate to real rate portion of JY model or z component of DK model.
INF alpha component. May relate to real rate portion of JY model or z component of DK model.
JY INF index sigma component.