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

#include <qle/termstructures/blackvariancesurfacemoneyness.hpp>

+ Inheritance diagram for BlackVarianceSurfaceMoneynessForward:
+ Collaboration diagram for BlackVarianceSurfaceMoneynessForward:

Public Member Functions

 BlackVarianceSurfaceMoneynessForward (const Calendar &cal, const Handle< Quote > &spot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &blackVolMatrix, const DayCounter &dayCounter, const Handle< YieldTermStructure > &forTS, const Handle< YieldTermStructure > &domTS, bool stickyStrike=false, bool flatExtrapMoneyness=false)
 
 BlackVarianceSurfaceMoneynessForward (const Date &referenceDate, const Calendar &cal, const Handle< Quote > &spot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &blackVolMatrix, const DayCounter &dayCounter, const Handle< YieldTermStructure > &forTS, const Handle< YieldTermStructure > &domTS, bool stickyStrike=false, bool flatExtrapMoneyness=false)
 Forward moneyness variance surface with a fixed reference date. More...
 
- Public Member Functions inherited from BlackVarianceSurfaceMoneyness
 BlackVarianceSurfaceMoneyness (const Calendar &cal, const Handle< Quote > &spot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &blackVolMatrix, const DayCounter &dayCounter, bool stickyStrike, bool flatExtrapMoneyness=false)
 
 BlackVarianceSurfaceMoneyness (const Date &referenceDate, const Calendar &cal, const Handle< Quote > &spot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &blackVolMatrix, const DayCounter &dayCounter, bool stickyStrike, bool flatExtrapMoneyness=false)
 Moneyness variance surface with a fixed reference date. More...
 
Date maxDate () const override
 
Real minStrike () const override
 
Real maxStrike () const override
 
void update () override
 
void performCalculations () const override
 
virtual void accept (AcyclicVisitor &) override
 
std::vector< QuantLib::Real > moneyness () const
 

Private Member Functions

void init ()
 
virtual Real moneyness (Time t, Real strike) const override
 

Private Attributes

Handle< YieldTermStructure > forTS_
 
Handle< YieldTermStructure > domTS_
 
std::vector< Real > forwards_
 
QuantLib::Interpolation forwardCurve_
 

Additional Inherited Members

- Protected Member Functions inherited from BlackVarianceSurfaceMoneyness
- Protected Attributes inherited from BlackVarianceSurfaceMoneyness
bool stickyStrike_
 
Handle< Quote > spot_
 
std::vector< Time > times_
 
std::vector< Real > moneyness_
 
bool flatExtrapMoneyness_
 

Detailed Description

Black volatility surface based on forward moneyness

Definition at line 143 of file blackvariancesurfacemoneyness.hpp.

Constructor & Destructor Documentation

◆ BlackVarianceSurfaceMoneynessForward() [1/2]

BlackVarianceSurfaceMoneynessForward ( const Calendar &  cal,
const Handle< Quote > &  spot,
const std::vector< Time > &  times,
const std::vector< Real > &  moneyness,
const std::vector< std::vector< Handle< Quote > > > &  blackVolMatrix,
const DayCounter &  dayCounter,
const Handle< YieldTermStructure > &  forTS,
const Handle< YieldTermStructure > &  domTS,
bool  stickyStrike = false,
bool  flatExtrapMoneyness = false 
)

Moneyness is defined here as forward moneyness, ie K/F

Definition at line 147 of file blackvariancesurfacemoneyness.cpp.

152 : BlackVarianceSurfaceMoneyness(cal, spot, times, moneyness, blackVolMatrix, dayCounter, stickyStrike,
153 flatExtrapMoneyness),
154 forTS_(forTS), domTS_(domTS) {
155 init();
156}
BlackVarianceSurfaceMoneyness(const Calendar &cal, const Handle< Quote > &spot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &blackVolMatrix, const DayCounter &dayCounter, bool stickyStrike, bool flatExtrapMoneyness=false)
std::vector< QuantLib::Real > moneyness() const
+ Here is the call graph for this function:

◆ BlackVarianceSurfaceMoneynessForward() [2/2]

BlackVarianceSurfaceMoneynessForward ( const Date &  referenceDate,
const Calendar &  cal,
const Handle< Quote > &  spot,
const std::vector< Time > &  times,
const std::vector< Real > &  moneyness,
const std::vector< std::vector< Handle< Quote > > > &  blackVolMatrix,
const DayCounter &  dayCounter,
const Handle< YieldTermStructure > &  forTS,
const Handle< YieldTermStructure > &  domTS,
bool  stickyStrike = false,
bool  flatExtrapMoneyness = false 
)

Forward moneyness variance surface with a fixed reference date.

Definition at line 158 of file blackvariancesurfacemoneyness.cpp.

163 : BlackVarianceSurfaceMoneyness(referenceDate, cal, spot, times, moneyness, blackVolMatrix, dayCounter,
164 stickyStrike, flatExtrapMoneyness),
165 forTS_(forTS), domTS_(domTS) {
166 init();
167}
+ Here is the call graph for this function:

Member Function Documentation

◆ init()

void init ( )
private

Definition at line 169 of file blackvariancesurfacemoneyness.cpp.

169 {
170
171 if (!stickyStrike_) {
172 QL_REQUIRE(!forTS_.empty(), "foreign discount curve required for atmf surface");
173 QL_REQUIRE(!domTS_.empty(), "domestic discount curve required for atmf surface");
174 registerWith(forTS_);
175 registerWith(domTS_);
176 } else {
177 for (Size i = 0; i < times_.size(); i++) {
178 Time t = times_[i];
179 Real fwd = spot_->value() * forTS_->discount(t) / domTS_->discount(t);
180 forwards_.push_back(fwd);
181 }
182 forwardCurve_ = Linear().interpolate(times_.begin(), times_.end(), forwards_.begin());
183 }
184}
+ Here is the caller graph for this function:

◆ moneyness()

Real moneyness ( Time  t,
Real  strike 
) const
overrideprivatevirtual

Implements BlackVarianceSurfaceMoneyness.

Definition at line 186 of file blackvariancesurfacemoneyness.cpp.

186 {
187 Real fwd;
188 Real reqMoneyness; // for flat extrapolation
189 if (strike == Null<Real>() || strike == 0)
190 return 1.0;
191 else {
192 if (stickyStrike_)
193 fwd = forwardCurve_(t, true);
194 else
195 fwd = spot_->value() * forTS_->discount(t) / domTS_->discount(t);
196 reqMoneyness = strike / fwd;
198 if ((strike / fwd) < moneyness_.front()) {
199 reqMoneyness = moneyness_.front();
200 } else if ((strike / fwd) > moneyness_.back()) {
201 reqMoneyness = moneyness_.back();
202 }
203 }
204 return reqMoneyness;
205 }
206}

Member Data Documentation

◆ forTS_

Handle<YieldTermStructure> forTS_
private

Definition at line 166 of file blackvariancesurfacemoneyness.hpp.

◆ domTS_

Handle<YieldTermStructure> domTS_
private

Definition at line 167 of file blackvariancesurfacemoneyness.hpp.

◆ forwards_

std::vector<Real> forwards_
private

Definition at line 168 of file blackvariancesurfacemoneyness.hpp.

◆ forwardCurve_

QuantLib::Interpolation forwardCurve_
private

Definition at line 169 of file blackvariancesurfacemoneyness.hpp.