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

#include <qle/methods/fdmquantohelper.hpp>

+ Inheritance diagram for FdmQuantoHelper:
+ Collaboration diagram for FdmQuantoHelper:

Public Member Functions

 FdmQuantoHelper (const ext::shared_ptr< YieldTermStructure > &rTS, const ext::shared_ptr< YieldTermStructure > &fTS, const ext::shared_ptr< BlackVolTermStructure > &fxVolTS, const Real equityFxCorrelation, const Real fxStrike, Real initialFxSpot=Null< Real >(), const bool discounting=true, const bool ensureNonNegativeForwardVariance=false)
 
Rate quantoAdjustment (Volatility equityVol, Time t1, Time t2) const
 
Array quantoAdjustment (const Array &equityVol, Time t1, Time t2) const
 

Private Attributes

const ext::shared_ptr< YieldTermStructure > rTS_
 
const ext::shared_ptr< YieldTermStructure > fTS_
 
const ext::shared_ptr< BlackVolTermStructurefxVolTS_
 
const Real equityFxCorrelation_
 
const Real fxStrike_
 
const Real initialFxSpot_
 
const bool discounting_
 
const bool ensureNonNegativeForwardVariance_
 

Detailed Description

As the ql class, but fxStrike can be null in which case the atmf level is used as a strike, more precisely we compute

forward vol = sqrt( ( V(t2, k2) - V(t1, k1) ) / (t2-t1) )

where k1, k2 are the atmf levels at t1 and t2. If fxStrike = null, the initialFxSpot value must be given.

If discounting = false, the adjustment will omit the rTS and fTS terms.

If ensureNonNegativeForwardVariance is true, the forward variances from the input vol ts are floored at zero.

Definition at line 46 of file fdmquantohelper.hpp.

Constructor & Destructor Documentation

◆ FdmQuantoHelper()

FdmQuantoHelper ( const ext::shared_ptr< YieldTermStructure > &  rTS,
const ext::shared_ptr< YieldTermStructure > &  fTS,
const ext::shared_ptr< BlackVolTermStructure > &  fxVolTS,
const Real  equityFxCorrelation,
const Real  fxStrike,
Real  initialFxSpot = Null<Real>(),
const bool  discounting = true,
const bool  ensureNonNegativeForwardVariance = false 
)

Definition at line 27 of file fdmquantohelper.cpp.

32 : rTS_(rTS), fTS_(fTS), fxVolTS_(fxVolTS), equityFxCorrelation_(equityFxCorrelation), fxStrike_(fxStrike),
33 initialFxSpot_(initialFxSpot), discounting_(discounting),
34 ensureNonNegativeForwardVariance_(ensureNonNegativeForwardVariance) {
35 QL_REQUIRE(fxStrike_ != Null<Real>() || initialFxSpot != Null<Real>(),
36 "initialFxSpot must be given, if fxStrike is null (=atmf)");
37}
const bool ensureNonNegativeForwardVariance_
const ext::shared_ptr< YieldTermStructure > fTS_
const ext::shared_ptr< BlackVolTermStructure > fxVolTS_
const ext::shared_ptr< YieldTermStructure > rTS_

Member Function Documentation

◆ quantoAdjustment() [1/2]

Rate quantoAdjustment ( Volatility  equityVol,
Time  t1,
Time  t2 
) const

Definition at line 39 of file fdmquantohelper.cpp.

39 {
40 Rate rDomestic = 0.0, rForeign = 0.0;
41 if (fxStrike_ == Null<Real>() || discounting_) {
42 rDomestic = rTS_->forwardRate(t1, t2, Continuous).rate();
43 rForeign = fTS_->forwardRate(t1, t2, Continuous).rate();
44 }
45 Real k1, k2;
46 if (fxStrike_ == Null<Real>()) {
47 k1 = initialFxSpot_ * fTS_->discount(t1) / rTS_->discount(t1);
48 k2 = initialFxSpot_ * fTS_->discount(t2) / rTS_->discount(t2);
49 } else {
50 k1 = k2 = fxStrike_;
51 }
52 Real v = ((close_enough(t2, 0.0) ? 0.0 : fxVolTS_->blackVariance(t2, k2)) -
53 (close_enough(t1, 0.0) ? 0.0 : fxVolTS_->blackVariance(t1, k1))) /
54 (t2 - t1);
56 v = std::max(v, 0.0);
57 const Volatility fxVol = std::sqrt(v);
58 return (discounting_ ? (rDomestic - rForeign) : 0.0) + equityVol * fxVol * equityFxCorrelation_;
59}
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
+ Here is the call graph for this function:

◆ quantoAdjustment() [2/2]

Array quantoAdjustment ( const Array &  equityVol,
Time  t1,
Time  t2 
) const

Definition at line 61 of file fdmquantohelper.cpp.

61 {
62 Rate rDomestic = 0.0, rForeign = 0.0;
63 if (fxStrike_ == Null<Real>() || discounting_) {
64 rDomestic = rTS_->forwardRate(t1, t2, Continuous).rate();
65 rForeign = fTS_->forwardRate(t1, t2, Continuous).rate();
66 }
67 Real k1, k2;
68 if (fxStrike_ == Null<Real>()) {
69 k1 = initialFxSpot_ * fTS_->discount(t1) / rTS_->discount(t1);
70 k2 = initialFxSpot_ * fTS_->discount(t2) / rTS_->discount(t2);
71 } else {
72 k1 = k2 = fxStrike_;
73 }
74 Real v = ((close_enough(t2, 0.0) ? 0.0 : fxVolTS_->blackVariance(t2, k2)) -
75 (close_enough(t1, 0.0) ? 0.0 : fxVolTS_->blackVariance(t1, k1))) /
76 (t2 - t1);
78 v = std::max(v, 0.0);
79 const Volatility fxVol = std::sqrt(v);
80 Array retVal(equityVol.size());
81 for (Size i = 0; i < retVal.size(); ++i) {
82 retVal[i] = (discounting_ ? (rDomestic - rForeign) : 0.0) + equityVol[i] * fxVol * equityFxCorrelation_;
83 }
84
85 return retVal;
86}
+ Here is the call graph for this function:

Member Data Documentation

◆ rTS_

const ext::shared_ptr<YieldTermStructure> rTS_
private

Definition at line 57 of file fdmquantohelper.hpp.

◆ fTS_

const ext::shared_ptr<YieldTermStructure> fTS_
private

Definition at line 57 of file fdmquantohelper.hpp.

◆ fxVolTS_

const ext::shared_ptr<BlackVolTermStructure> fxVolTS_
private

Definition at line 58 of file fdmquantohelper.hpp.

◆ equityFxCorrelation_

const Real equityFxCorrelation_
private

Definition at line 59 of file fdmquantohelper.hpp.

◆ fxStrike_

const Real fxStrike_
private

Definition at line 59 of file fdmquantohelper.hpp.

◆ initialFxSpot_

const Real initialFxSpot_
private

Definition at line 59 of file fdmquantohelper.hpp.

◆ discounting_

const bool discounting_
private

Definition at line 60 of file fdmquantohelper.hpp.

◆ ensureNonNegativeForwardVariance_

const bool ensureNonNegativeForwardVariance_
private

Definition at line 60 of file fdmquantohelper.hpp.