Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
OptionletTraits Struct Reference

Traits class that is needed for Bootstrap classes to work More...

#include <qle/termstructures/piecewiseoptionletcurve.hpp>

+ Collaboration diagram for OptionletTraits:

Public Types

typedef QuantLib::BootstrapHelper< QuantLib::OptionletVolatilityStructure > helper
 Helper type. More...
 

Static Public Member Functions

static QuantLib::Date initialDate (const QuantLib::OptionletVolatilityStructure *ovts)
 Start date of the optionlet volatility term structure. More...
 
static QuantLib::Real initialValue (const QuantLib::OptionletVolatilityStructure *ovts)
 The value at the reference date of the term structure. More...
 
template<class C >
static QuantLib::Real guess (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 Guesses. More...
 
template<class C >
static QuantLib::Real minValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 Minimum value after a given iteration. Lower bound for optionlet volatility is 0. More...
 
template<class C >
static QuantLib::Real maxValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
 Maximum value after a given iteration. More...
 
static void updateGuess (std::vector< QuantLib::Real > &data, QuantLib::Real vol, QuantLib::Size i)
 Root finding update. More...
 
static QuantLib::Size maxIterations ()
 Maximum number of iterations to perform in search for root. More...
 

Detailed Description

Traits class that is needed for Bootstrap classes to work

Definition at line 36 of file piecewiseoptionletcurve.hpp.

Member Typedef Documentation

◆ helper

typedef QuantLib::BootstrapHelper<QuantLib::OptionletVolatilityStructure> helper

Helper type.

Definition at line 39 of file piecewiseoptionletcurve.hpp.

Member Function Documentation

◆ initialDate()

static QuantLib::Date initialDate ( const QuantLib::OptionletVolatilityStructure *  ovts)
static

Start date of the optionlet volatility term structure.

Definition at line 42 of file piecewiseoptionletcurve.hpp.

42 {
43 return ovts->referenceDate();
44 }

◆ initialValue()

static QuantLib::Real initialValue ( const QuantLib::OptionletVolatilityStructure *  ovts)
static

The value at the reference date of the term structure.

Definition at line 47 of file piecewiseoptionletcurve.hpp.

47{ return 0.0; }

◆ guess()

static QuantLib::Real guess ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Guesses.

Definition at line 50 of file piecewiseoptionletcurve.hpp.

50 {
51
52 // Previous value
53 if (validData) {
54 return c->data()[i];
55 }
56
57 // First iteration, not sure if we can do any better here.
58 if (i == 1) {
59 if (c->volatilityType() == QuantLib::Normal) {
60 return 0.0020;
61 } else {
62 return 0.20;
63 }
64 }
65
66 // Flat extrapolation
67 return c->data()[i - 1];
68 }

◆ minValueAfter()

static QuantLib::Real minValueAfter ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Minimum value after a given iteration. Lower bound for optionlet volatility is 0.

Definition at line 72 of file piecewiseoptionletcurve.hpp.

72 {
73 // Choose arbitrarily small positive number
74 if (c->volatilityType() == QuantLib::Normal) {
75 return 1e-8;
76 } else {
77 return 1e-4;
78 }
79 }

◆ maxValueAfter()

static QuantLib::Real maxValueAfter ( QuantLib::Size  i,
const C *  c,
bool  validData,
QuantLib::Size   
)
static

Maximum value after a given iteration.

Definition at line 83 of file piecewiseoptionletcurve.hpp.

83 {
84 // Choose large and reasonable positive number
85 // Not sure if it makes sense to attempt to use value at previous pillar
86 if (c->volatilityType() == QuantLib::Normal) {
87 return 0.50;
88 } else {
89 return 5;
90 }
91 }

◆ updateGuess()

static void updateGuess ( std::vector< QuantLib::Real > &  data,
QuantLib::Real  vol,
QuantLib::Size  i 
)
static

Root finding update.

Definition at line 94 of file piecewiseoptionletcurve.hpp.

94{ data[i] = vol; }

◆ maxIterations()

static QuantLib::Size maxIterations ( )
static

Maximum number of iterations to perform in search for root.

Definition at line 97 of file piecewiseoptionletcurve.hpp.

97{ return 100; }