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

Analytic cross-asset lgm equity option engine. More...

#include <qle/pricingengines/analyticxassetlgmeqoptionengine.hpp>

+ Inheritance diagram for AnalyticXAssetLgmEquityOptionEngine:
+ Collaboration diagram for AnalyticXAssetLgmEquityOptionEngine:

Public Member Functions

 AnalyticXAssetLgmEquityOptionEngine (const QuantLib::ext::shared_ptr< CrossAssetModel > &model, const Size equityIdx, const Size ccyIdx)
 
void calculate () const override
 
Real value (const Time t0, const Time t, const QuantLib::ext::shared_ptr< StrikedTypePayoff > payoff, const Real domesticDiscount, const Real eqForward) const
 

Private Attributes

const QuantLib::ext::shared_ptr< CrossAssetModelmodel_
 
const Size eqIdx_
 
const Size ccyIdx_
 

Detailed Description

Analytic cross-asset lgm equity option engine.

This class prices an equity option analytically using the dynamics of a CrossAssetModel. The formula is black-like, with the variance of the underlying equity being dependent upon the dynamics of related interest and FX rates within the CrossAssetModel universe. See the book "Modern Derivatives Pricing and Credit Exposure Analysis" by Lichters, Stamm and Gallagher.

Definition at line 43 of file analyticxassetlgmeqoptionengine.hpp.

Constructor & Destructor Documentation

◆ AnalyticXAssetLgmEquityOptionEngine()

AnalyticXAssetLgmEquityOptionEngine ( const QuantLib::ext::shared_ptr< CrossAssetModel > &  model,
const Size  equityIdx,
const Size  ccyIdx 
)

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 58 of file analyticxassetlgmeqoptionengine.cpp.

58 {
59
60 QL_REQUIRE(arguments_.exercise->type() == Exercise::European, "only European options are allowed");
61
62 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
63 QL_REQUIRE(payoff != NULL, "only striked payoff is allowed");
64
65 Date expiry = arguments_.exercise->lastDate();
66 Time t = model_->irlgm1f(0)->termStructure()->timeFromReference(expiry);
67
68 if (t <= 0.0) {
69 // option is expired, we do not value any possibly non settled
70 // flows, i.e. set the npv to zero in this case
71 results_.value = 0.0;
72 return;
73 }
74
75 Real divDiscount = model_->eqbs(eqIdx_)->equityDivYieldCurveToday()->discount(expiry);
76 Real eqIrDiscount = model_->eqbs(eqIdx_)->equityIrCurveToday()->discount(expiry);
77 Real cashflowsDiscount = model_->irlgm1f(ccyIdx_)->termStructure()->discount(expiry);
78
79 Real eqForward = model_->eqbs(eqIdx_)->eqSpotToday()->value() * divDiscount / eqIrDiscount;
80
81 results_.value = value(0.0, t, payoff, cashflowsDiscount, eqForward);
82
83} // calculate()
const Instrument::results * results_
Definition: cdsoption.cpp:81
Real value(const Time t0, const Time t, const QuantLib::ext::shared_ptr< StrikedTypePayoff > payoff, const Real domesticDiscount, const Real eqForward) const
Swap::arguments * arguments_
+ Here is the call graph for this function:

◆ value()

Real value ( const Time  t0,
const Time  t,
const QuantLib::ext::shared_ptr< StrikedTypePayoff >  payoff,
const Real  domesticDiscount,
const Real  eqForward 
) const

the actual option price calculation, exposed to public, since it is useful to directly use the core computation sometimes

Definition at line 32 of file analyticxassetlgmeqoptionengine.cpp.

34 {
35
36 const Size& k = eqIdx_;
37 const Size& i = ccyIdx_;
38
39 Real Hi_t = Hz(i).eval(*model_, t);
40
41 // calculate the full variance. This is the equity analogy to eqn: 12.18 in Lichters,Stamm,Gallagher
42 Real variance = 0;
43 variance += (vs(k).eval(*model_, t) - vs(k).eval(*model_, t0));
44
45 variance += Hi_t * Hi_t * (zetaz(i).eval(*model_, t) - zetaz(i).eval(*model_, t0));
46 variance -= 2.0 * Hi_t * integral(*model_, P(Hz(i), az(i), az(i)), t0, t);
47 variance += integral(*model_, P(Hz(i), Hz(i), az(i), az(i)), t0, t);
48
49 variance += 2.0 * Hi_t * integral(*model_, P(rzs(i, k), ss(k), az(i)), t0, t);
50 variance -= 2.0 * integral(*model_, P(Hz(i), rzs(i, k), ss(k), az(i)), t0, t);
51
52 Real stdev = sqrt(variance);
53 BlackCalculator black(payoff, eqForward, stdev, discount);
54
55 return black.value();
56}
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)
RandomVariable variance(const RandomVariable &r)
RandomVariable black(const RandomVariable &omega, const RandomVariable &t, const RandomVariable &strike, const RandomVariable &forward, const RandomVariable &impliedVol)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ model_

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

Definition at line 56 of file analyticxassetlgmeqoptionengine.hpp.

◆ eqIdx_

const Size eqIdx_
private

Definition at line 57 of file analyticxassetlgmeqoptionengine.hpp.

◆ ccyIdx_

const Size ccyIdx_
private

Definition at line 57 of file analyticxassetlgmeqoptionengine.hpp.