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

Analytic dk cpi cap floor engine. More...

#include <qle/pricingengines/analyticdkcpicapfloorengine.hpp>

+ Inheritance diagram for AnalyticDkCpiCapFloorEngine:
+ Collaboration diagram for AnalyticDkCpiCapFloorEngine:

Public Member Functions

 AnalyticDkCpiCapFloorEngine (const QuantLib::ext::shared_ptr< CrossAssetModel > &model, const Size index, const Real baseCPI)
 
void calculate () const override
 

Private Attributes

const QuantLib::ext::shared_ptr< CrossAssetModelmodel_
 
const Size index_
 
const Real baseCPI_
 

Detailed Description

Analytic dk cpi cap floor engine.

Definition at line 34 of file analyticdkcpicapfloorengine.hpp.

Constructor & Destructor Documentation

◆ AnalyticDkCpiCapFloorEngine()

AnalyticDkCpiCapFloorEngine ( const QuantLib::ext::shared_ptr< CrossAssetModel > &  model,
const Size  index,
const Real  baseCPI 
)

Definition at line 28 of file analyticdkcpicapfloorengine.cpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 32 of file analyticdkcpicapfloorengine.cpp.

32 {
33
34 QL_DEPRECATED_DISABLE_WARNING
35 bool interpolate = arguments_.observationInterpolation == CPI::Linear ||
36 (arguments_.observationInterpolation == CPI::AsIndex && arguments_.index->interpolated());
37 QL_DEPRECATED_ENABLE_WARNING
38
39 Real t = inflationYearFraction(arguments_.index->frequency(), interpolate,
40 model_->infdk(index_)->termStructure()->dayCounter(),
41 model_->infdk(index_)->termStructure()->baseDate(), arguments_.fixDate);
42
43 if (t <= 0.0) {
44 // option is expired, we do not value any possibly non settled
45 // flows, i.e. set the npv to zero in this case
46 results_.value = 0.0;
47 return;
48 }
49
50 // Book, 13.37, 13.38
51
52 Real k = std::pow(1.0 + arguments_.strike, t);
53 Real kTilde = k * arguments_.baseCPI;
54 Real nTilde = arguments_.nominal / arguments_.baseCPI;
55
56 Real m = baseCPI_ *
57 std::pow(1.0 + model_->infdk(index_)->termStructure()->zeroRate(arguments_.fixDate, Period(0, Days)), t);
58 m = arguments_.index->fixing(arguments_.fixDate);
59 Real Ht = Hy(index_).eval(*model_, t);
60 Real v = Ht * Ht * zetay(index_).eval(*model_, t) -
61 2.0 * Ht * integral(*model_, P(Hy(index_), ay(index_), ay(index_)), 0.0, t) +
62 integral(*model_, P(Hy(index_), Hy(index_), ay(index_), ay(index_)), 0.0, t);
63
64 Size irIdx = model_->ccyIndex(model_->infdk(index_)->currency());
65 Real discount = model_->irlgm1f(irIdx)->termStructure()->discount(arguments_.payDate);
66
67 results_.value = nTilde * blackFormula(arguments_.type, kTilde, m, std::sqrt(v), discount);
68
69} // calculate()
const Instrument::results * results_
Definition: cdsoption.cpp:81
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)
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 40 of file analyticdkcpicapfloorengine.hpp.

◆ index_

const Size index_
private

Definition at line 41 of file analyticdkcpicapfloorengine.hpp.

◆ baseCPI_

const Real baseCPI_
private

Definition at line 42 of file analyticdkcpicapfloorengine.hpp.