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

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

#include <qle/termstructures/piecewisepricecurve.hpp>

+ Collaboration diagram for PriceTraits:

Public Types

typedef QuantLib::BootstrapHelper< PriceTermStructurehelper
 Helper type. More...
 

Static Public Member Functions

static QuantLib::Date initialDate (const PriceTermStructure *ts)
 Start date of the term structure. More...
 
static QuantLib::Real initialValue (const PriceTermStructure *ts)
 Dummy value at reference date. Updated below along with first guess. More...
 
template<class C >
static QuantLib::Real guess (QuantLib::Size i, const C *c, bool validData, QuantLib::Size j)
 Guesses. More...
 
template<class C >
static QuantLib::Real minValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size j)
 Minimum value after a given iteration. More...
 
template<class C >
static QuantLib::Real maxValueAfter (QuantLib::Size i, const C *c, bool validData, QuantLib::Size j)
 Maximum value after a given iteration. More...
 
static void updateGuess (std::vector< QuantLib::Real > &data, QuantLib::Real price, 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 piecewisepricecurve.hpp.

Member Typedef Documentation

◆ helper

typedef QuantLib::BootstrapHelper<PriceTermStructure> helper

Helper type.

Definition at line 39 of file piecewisepricecurve.hpp.

Member Function Documentation

◆ initialDate()

static QuantLib::Date initialDate ( const PriceTermStructure ts)
static

Start date of the term structure.

Definition at line 42 of file piecewisepricecurve.hpp.

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

◆ initialValue()

static QuantLib::Real initialValue ( const PriceTermStructure ts)
static

Dummy value at reference date. Updated below along with first guess.

Definition at line 47 of file piecewisepricecurve.hpp.

47 {
48 return 1.0;
49 }

◆ guess()

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

Guesses.

Definition at line 53 of file piecewisepricecurve.hpp.

53 {
54 // Take the market value from the helper. Here, we rely on the all the helpers being alive and sorted.
55 // We will check this in the PiecewisePriceCurve constructor.
56 return c->instrument(i-1)->quote()->value();
57 }
+ Here is the caller graph for this function:

◆ minValueAfter()

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

Minimum value after a given iteration.

Definition at line 61 of file piecewisepricecurve.hpp.

61 {
62 // Bounds around the guess. Can widen these and try again within the bootstrap.
63 Real g = guess(i, c, validData, j);
64 return g < 0.0 ? g * 5.0 / 4.0 : g * 3.0 / 4.0;
65 }
static QuantLib::Real guess(QuantLib::Size i, const C *c, bool validData, QuantLib::Size j)
Guesses.
+ Here is the call graph for this function:

◆ maxValueAfter()

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

Maximum value after a given iteration.

Definition at line 69 of file piecewisepricecurve.hpp.

69 {
70 // Bounds around the guess. Can widen these and try again within the bootstrap.
71 Real g = guess(i, c, validData, j);
72 return g < 0.0 ? g * 3.0 / 4.0 : g * 5.0 / 4.0;
73 }
+ Here is the call graph for this function:

◆ updateGuess()

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

Root finding update.

Definition at line 76 of file piecewisepricecurve.hpp.

76 {
77 data[i] = price;
78 // Update the value at the reference date also.
79 if (i == 1)
80 data[0] = price;
81 }

◆ maxIterations()

static QuantLib::Size maxIterations ( )
static

Maximum number of iterations to perform in search for root.

Definition at line 84 of file piecewisepricecurve.hpp.

84{ return 100; }