Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
AnalyticJyCpiCapFloorEngine Class Reference

#include <qle/pricingengines/analyticjycpicapfloorengine.hpp>

+ Inheritance diagram for AnalyticJyCpiCapFloorEngine:
+ Collaboration diagram for AnalyticJyCpiCapFloorEngine:

Public Member Functions

 AnalyticJyCpiCapFloorEngine (const QuantLib::ext::shared_ptr< CrossAssetModel > &model, QuantLib::Size index)
 

PricingEngine interface

const QuantLib::ext::shared_ptr< CrossAssetModelmodel_
 
QuantLib::Size index_
 
void calculate () const override
 

Detailed Description

Analytic Jarrow Yildrim (JY) CPI cap floor engine

Definition at line 35 of file analyticjycpicapfloorengine.hpp.

Constructor & Destructor Documentation

◆ AnalyticJyCpiCapFloorEngine()

AnalyticJyCpiCapFloorEngine ( const QuantLib::ext::shared_ptr< CrossAssetModel > &  model,
QuantLib::Size  index 
)

Constructor

Parameters
modelthe cross asset model to be used in the valuation.
indexthe index of the inflation component to use within the cross asset model.

Definition at line 35 of file analyticjycpicapfloorengine.cpp.

36 : model_(model), index_(index) {}
const QuantLib::ext::shared_ptr< CrossAssetModel > model_

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 38 of file analyticjycpicapfloorengine.cpp.

38 {
39
40 // If the pay date has occurred, nothing to do.
41 SimpleCashFlow cf(0.0, arguments_.payDate);
42 if (cf.hasOccurred()) {
43 results_.value = 0.0;
44 return;
45 }
46
47 // Discount factor to pay date will be needed below.
48 Size irIdx = model_->ccyIndex(model_->infjy(index_)->currency());
49 DiscountFactor df = model_->irlgm1f(irIdx)->termStructure()->discount(arguments_.payDate);
50
51 QL_DEPRECATED_DISABLE_WARNING
52 bool interpolate = arguments_.observationInterpolation == CPI::Linear ||
53 (arguments_.observationInterpolation == CPI::AsIndex && arguments_.index->interpolated());
54 QL_DEPRECATED_ENABLE_WARNING
55 // Get the time to expiry. This determines if we use the JY model or look for an inflation index fixing.
56 auto zts = model_->infjy(index_)->realRate()->termStructure();
57 Real t = inflationYearFraction(arguments_.index->frequency(), interpolate, zts->dayCounter(), zts->baseDate(),
58 arguments_.fixDate);
59
60 // If time to expiry is non-positive, we return the discounted value of the settled amount.
61 // CPICapFloor should really have its own day counter for going from strike rate to k. We use t here.
62 Real k = pow(1.0 + arguments_.strike, t);
63 if (t <= 0.0) {
64 auto cpiAtExpiry = arguments_.index->fixing(arguments_.fixDate);
65 if (arguments_.type == Option::Call) {
66 results_.value = max(cpiAtExpiry / arguments_.baseCPI - k, 0.0);
67 } else {
68 results_.value = max(k - cpiAtExpiry / arguments_.baseCPI, 0.0);
69 }
70 results_.value *= arguments_.nominal * df;
71 return;
72 }
73
74 // Section 13, Book. ZCII Cap. Note that there is a difference between the base CPI value associated with the
75 // inflation term structures and used as a starting point in the CAM evolution vs. the contractual base CPI in
76 // the CPICapFloor instrument. The former is curveBaseCpi below and the latter is arguments_.baseCPI.
77
78 // Calculate the variance, \Sigma^2_I in the book.
79 Real H_n_t = Hz(irIdx).eval(*model_, t);
80 Real H_r_t = Hy(index_).eval(*model_, t);
81 Real v = integral(*model_, P(LC(H_n_t, -1.0, Hz(irIdx)), LC(H_n_t, -1.0, Hz(irIdx)), az(irIdx), az(irIdx)), 0.0, t);
82 v += integral(*model_, P(LC(H_r_t, -1.0, Hy(index_)), LC(H_r_t, -1.0, Hy(index_)), ay(index_), ay(index_)), 0.0, t);
83 v += integral(*model_, P(sy(index_), sy(index_)), 0.0, t);
84 v -= 2 *
86 P(rzy(irIdx, index_), LC(H_r_t, -1.0, Hy(index_)), LC(H_n_t, -1.0, Hz(irIdx)), ay(index_), az(irIdx)),
87 0.0, t);
88 v += 2 * integral(*model_, P(rzy(irIdx, index_, 1), LC(H_n_t, -1.0, Hz(irIdx)), az(irIdx), sy(index_)), 0.0, t);
89 v -= 2 *
90 integral(*model_, P(ryy(index_, index_, 0, 1), LC(H_r_t, -1.0, Hy(index_)), ay(index_), sy(index_)), 0.0, t);
91
92 // Calculate the forward CPI, F_I(0,T) in the book.
93 Real fwd = arguments_.index->fixing(arguments_.fixDate);
94
95 // Get adjusted nominal and strike, \tilde{N} and \tilde{K} from the book.
96 Real adjNominal = arguments_.nominal / arguments_.baseCPI;
97 Real adjStrike = k * arguments_.baseCPI;
98
99 results_.value = adjNominal * blackFormula(arguments_.type, adjStrike, fwd, sqrt(v), df);
100}
const Instrument::results * results_
Definition: cdsoption.cpp:81
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)
RandomVariable sqrt(RandomVariable x)
CompiledFormula pow(CompiledFormula x, const CompiledFormula &y)
CompiledFormula max(CompiledFormula x, const CompiledFormula &y)
INF H component. May relate to real rate portion of JY model or z component of DK model.
QuantLib::Real eval(const CrossAssetModel &x, const QuantLib::Real t) const
Real eval(const CrossAssetModel &x, const Real t) const
INF alpha component. May relate to real rate portion of JY model or z component of DK model.
JY INF index sigma component.
Swap::arguments * arguments_
+ Here is the call graph for this function:

Member Data Documentation

◆ model_

const QuantLib::ext::shared_ptr<CrossAssetModel> model_
private

Definition at line 50 of file analyticjycpicapfloorengine.hpp.

◆ index_

QuantLib::Size index_
private

Definition at line 51 of file analyticjycpicapfloorengine.hpp.