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

#include <qle/termstructures/fxvannavolgasmilesection.hpp>

+ Inheritance diagram for VannaVolgaSmileSection:
+ Collaboration diagram for VannaVolgaSmileSection:

Public Member Functions

 VannaVolgaSmileSection (Real spot, Real rd, Real rf, Time t, Volatility atmVol, Volatility rr, Volatility bf, bool firstApprox=false, const DeltaVolQuote::AtmType &atmType=DeltaVolQuote::AtmType::AtmDeltaNeutral, const DeltaVolQuote::DeltaType &deltaType=DeltaVolQuote::DeltaType::Spot, const Real delta=0.25)
 
Real k_atm () const
 getters for unit test More...
 
Real k_c () const
 
Real k_p () const
 
Volatility vol_atm () const
 
Volatility vol_c () const
 
Volatility vol_p () const
 
- Public Member Functions inherited from FxSmileSection
 FxSmileSection ()
 
 FxSmileSection (Real spot, Real rd, Real rf, Time t)
 
virtual ~FxSmileSection ()
 
virtual Volatility volatility (Real strike) const =0
 
DiscountFactor domesticDiscount () const
 
DiscountFactor foreignDiscount () const
 

FxSmileSection interface

Real k_atm_
 
Real k_c_
 
Real k_p_
 
Volatility atmVol_
 
Volatility rr_
 
Volatility bf_
 
Volatility vol_c_
 
Volatility vol_p_
 
bool firstApprox_
 
Volatility volatility (Real strike) const override
 
Real d1 (Real x) const
 
Real d2 (Real x) const
 

Additional Inherited Members

- Protected Attributes inherited from FxSmileSection
Real spot_
 
Real rd_
 
Real rf_
 
Time t_
 

Detailed Description

Vanna Volga Smile section

Consistent Pricing of FX Options Castagna & Mercurio (2006) http://papers.ssrn.com/sol3/papers.cfm?abstract_id=873788

Definition at line 41 of file fxvannavolgasmilesection.hpp.

Constructor & Destructor Documentation

◆ VannaVolgaSmileSection()

VannaVolgaSmileSection ( Real  spot,
Real  rd,
Real  rf,
Time  t,
Volatility  atmVol,
Volatility  rr,
Volatility  bf,
bool  firstApprox = false,
const DeltaVolQuote::AtmType &  atmType = DeltaVolQuote::AtmType::AtmDeltaNeutral,
const DeltaVolQuote::DeltaType &  deltaType = DeltaVolQuote::DeltaType::Spot,
const Real  delta = 0.25 
)

Definition at line 26 of file fxvannavolgasmilesection.cpp.

29 : FxSmileSection(spot, rd, rf, t), atmVol_(atmVol), rr_(rr), bf_(bf), firstApprox_(firstApprox) {
30
31 // Consistent Pricing of FX Options
32 // Castagna & Mercurio (2006)
33 // eq(4) + (5).
34 vol_c_ = atmVol + bf_ + 0.5 * rr_;
35 vol_p_ = atmVol + bf_ - 0.5 * rr_;
36
37 // infer strikes from delta and vol quote
38 try {
39 BlackDeltaCalculator a(Option::Type::Call, deltaType, spot, domesticDiscount(), foreignDiscount(),
40 sqrt(t) * atmVol);
41 k_atm_ = a.atmStrike(atmType);
42 } catch (const std::exception& e) {
43 QL_FAIL("VannaVolgaSmileSection: Error during calculating atm strike: "
44 << e.what() << " (t=" << t << ", atmVol=" << atmVol << ", bf=" << bf_ << ", rr=" << rr << ", vol_c="
45 << vol_c_ << ", vol_p=" << vol_p_ << ", atmType=" << atmType << ", deltaType=" << deltaType
46 << ", spot=" << spot << ", domDsc=" << domesticDiscount() << ", forDsc=" << foreignDiscount() << ")");
47 }
48
49 try {
50 BlackDeltaCalculator c(Option::Type::Call, deltaType, spot, domesticDiscount(), foreignDiscount(),
51 sqrt(t) * vol_c_);
52 k_c_ = c.strikeFromDelta(delta);
53 } catch (const std::exception& e) {
54 QL_FAIL("VannaVolgaSmileSection: Error during calculating call strike at delta "
55 << delta << ": " << e.what() << " (t=" << t << ", atmVol=" << atmVol << ", bf=" << bf_ << ", rr=" << rr
56 << ", vol_c=" << vol_c_ << ", vol_p=" << vol_p_ << ", deltaType=" << deltaType << ", spot=" << spot
57 << ", domDsc=" << domesticDiscount() << ", forDsc=" << foreignDiscount() << ")");
58 }
59
60 try {
61 BlackDeltaCalculator p(Option::Type::Put, deltaType, spot, domesticDiscount(), foreignDiscount(),
62 sqrt(t) * vol_p_);
63 k_p_ = p.strikeFromDelta(-delta);
64 } catch (const std::exception& e) {
65 QL_FAIL("VannaVolgaSmileSection: Error during calculating put strike at delta "
66 << delta << ": " << e.what() << " (t=" << t << ", atmVol=" << atmVol << ", bf=" << bf_ << ", rr=" << rr
67 << ", vol_c=" << vol_c_ << ", vol_p=" << vol_p_ << ", deltaType=" << deltaType << ", spot=" << spot
68 << ", domDsc=" << domesticDiscount() << ", forDsc=" << foreignDiscount() << ")");
69 }
70}
DiscountFactor domesticDiscount() const
DiscountFactor foreignDiscount() const
RandomVariable sqrt(RandomVariable x)
+ Here is the call graph for this function:

Member Function Documentation

◆ k_atm()

Real k_atm ( ) const

getters for unit test

Definition at line 50 of file fxvannavolgasmilesection.hpp.

50{ return k_atm_; }
+ Here is the caller graph for this function:

◆ k_c()

Real k_c ( ) const

Definition at line 51 of file fxvannavolgasmilesection.hpp.

51{ return k_c_; }
+ Here is the caller graph for this function:

◆ k_p()

Real k_p ( ) const

Definition at line 52 of file fxvannavolgasmilesection.hpp.

52{ return k_p_; }
+ Here is the caller graph for this function:

◆ vol_atm()

Volatility vol_atm ( ) const

Definition at line 53 of file fxvannavolgasmilesection.hpp.

53{ return atmVol_; }
+ Here is the caller graph for this function:

◆ vol_c()

Volatility vol_c ( ) const

Definition at line 54 of file fxvannavolgasmilesection.hpp.

54{ return vol_c_; }
+ Here is the caller graph for this function:

◆ vol_p()

Volatility vol_p ( ) const

Definition at line 55 of file fxvannavolgasmilesection.hpp.

55{ return vol_p_; }
+ Here is the caller graph for this function:

◆ volatility()

Volatility volatility ( Real  strike) const
overridevirtual

Implements FxSmileSection.

Definition at line 80 of file fxvannavolgasmilesection.cpp.

80 {
81 QL_REQUIRE(k >= 0, "Non-positive strike (" << k << ")");
82
83 // eq(14). Note sigma = sigma_ATM here.
84 Real k1 = k_p_;
85 Real k2 = k_atm_;
86 Real k3 = k_c_;
87
88 // TODO: Cache the (constant) denominator
89 Real r1 = log(k2 / k) * log(k3 / k) / (log(k2 / k1) * log(k3 / k1));
90 Real r2 = log(k / k1) * log(k3 / k) / (log(k2 / k1) * log(k3 / k2));
91 Real r3 = log(k / k1) * log(k / k2) / (log(k3 / k1) * log(k3 / k2));
92
93 Real sigma1_k = r1 * vol_p_ + r2 * atmVol_ + r3 * vol_c_;
94 if (firstApprox_) {
95 return std::max(sigma1_k, Real(0.0001)); // for extreme ends: cannot return negative impl vols
96 }
97
98 Real D1 = sigma1_k - atmVol_;
99
100 // No middle term as sigma = sigma_atm
101 Real D2 = r1 * d1(k1) * d2(k1) * (vol_p_ - atmVol_) * (vol_p_ - atmVol_) +
102 r3 * d1(k3) * d2(k3) * (vol_c_ - atmVol_) * (vol_c_ - atmVol_);
103
104 Real d1d2k = d1(k) * d2(k);
105
106 Real tmp = atmVol_ * atmVol_ + d1d2k * (2 * atmVol_ * D1 + D2);
107 QL_REQUIRE(tmp >= 0, "VannaVolga attempting to take square root of negative number in second approximation. "
108 "Consider using first approximation in fxvol config.");
109
110 return atmVol_ + (-atmVol_ + sqrt(tmp)) / d1d2k;
111}
CompiledFormula log(CompiledFormula x)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ d1()

Real d1 ( Real  x) const
private

Definition at line 72 of file fxvannavolgasmilesection.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ d2()

Real d2 ( Real  x) const
private

Definition at line 76 of file fxvannavolgasmilesection.cpp.

76 {
77 return (log(spot_ / x) + (rd_ - rf_ - 0.5 * atmVol_ * atmVol_) * t_) / (atmVol_ * sqrt(t_));
78}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ k_atm_

Real k_atm_
private

Definition at line 66 of file fxvannavolgasmilesection.hpp.

◆ k_c_

Real k_c_
private

Definition at line 66 of file fxvannavolgasmilesection.hpp.

◆ k_p_

Real k_p_
private

Definition at line 66 of file fxvannavolgasmilesection.hpp.

◆ atmVol_

Volatility atmVol_
private

Definition at line 67 of file fxvannavolgasmilesection.hpp.

◆ rr_

Volatility rr_
private

Definition at line 67 of file fxvannavolgasmilesection.hpp.

◆ bf_

Volatility bf_
private

Definition at line 67 of file fxvannavolgasmilesection.hpp.

◆ vol_c_

Volatility vol_c_
private

Definition at line 68 of file fxvannavolgasmilesection.hpp.

◆ vol_p_

Volatility vol_p_
private

Definition at line 68 of file fxvannavolgasmilesection.hpp.

◆ firstApprox_

bool firstApprox_
private

Definition at line 69 of file fxvannavolgasmilesection.hpp.