QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Types | Private Types | List of all members
PiecewiseYieldCurve< Traits, Interpolator, Bootstrap > Class Template Reference

Piecewise yield term structure. More...

#include <ql/termstructures/yield/piecewiseyieldcurve.hpp>

+ Inheritance diagram for PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >:
+ Collaboration diagram for PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >:

Public Types

typedef Traits traits_type
 
typedef Interpolator interpolator_type
 
typedef Bootstrap< this_curvebootstrap_type
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Public Member Functions

Constructors
 PiecewiseYieldCurve (const Date &referenceDate, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, const std::vector< Handle< Quote > > &jumps={}, const std::vector< Date > &jumpDates={}, const Interpolator &i={}, bootstrap_type bootstrap={})
 
 PiecewiseYieldCurve (const Date &referenceDate, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, const Interpolator &i, bootstrap_type bootstrap=bootstrap_type())
 
 PiecewiseYieldCurve (const Date &referenceDate, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, bootstrap_type bootstrap)
 
 PiecewiseYieldCurve (Natural settlementDays, const Calendar &calendar, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, const std::vector< Handle< Quote > > &jumps={}, const std::vector< Date > &jumpDates={}, const Interpolator &i={}, bootstrap_type bootstrap={})
 
 PiecewiseYieldCurve (Natural settlementDays, const Calendar &calendar, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, const Interpolator &i, bootstrap_type bootstrap=bootstrap_type())
 
 PiecewiseYieldCurve (Natural settlementDays, const Calendar &calendar, const std::vector< ext::shared_ptr< typename Traits::helper > > &instruments, const DayCounter &dayCounter, const bootstrap_type &bootstrap)
 
TermStructure interface
Date maxDate () const override
 
base_curve interface
const std::vector< Time > & times () const
 
const std::vector< Date > & dates () const
 
const std::vector< Real > & data () const
 
std::vector< std::pair< Date, Real > > nodes () const
 
Observer interface
void update () override
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Private Types

typedef Traits::template curve< Interpolator >::type base_curve
 
typedef PiecewiseYieldCurve< Traits, Interpolator, Bootstrap > this_curve
 

LazyObject interface

std::vector< ext::shared_ptr< typename Traits::helper > > instruments_
 
Real accuracy_
 
Bootstrap< this_curvebootstrap_
 
class MultiCurveSensitivities
 
class Bootstrap< this_curve >
 
class BootstrapError< this_curve >
 
class PenaltyFunction< this_curve >
 
void performCalculations () const override
 
DiscountFactor discountImpl (Time) const override
 

Additional Inherited Members

- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

template<class Traits, class Interpolator, template< class > class Bootstrap = IterativeBootstrap>
class QuantLib::PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >

Piecewise yield term structure.

This term structure is bootstrapped on a number of interest rate instruments which are passed as a vector of pointers to RateHelper instances. Their maturities mark the boundaries of the interpolated segments.

Each segment is determined sequentially starting from the earliest period to the latest and is chosen so that the instrument whose maturity marks the end of such segment is correctly repriced on the curve.

Warning:
The bootstrapping algorithm will raise an exception if any two instruments have the same maturity date.
Tests:
  • the correctness of the returned values is tested by checking them against the original inputs.
  • the observability of the term structure is tested.
Examples
CDS.cpp.

Definition at line 62 of file piecewiseyieldcurve.hpp.

Member Typedef Documentation

◆ base_curve

typedef Traits::template curve<Interpolator>::type base_curve
private

Definition at line 66 of file piecewiseyieldcurve.hpp.

◆ this_curve

typedef PiecewiseYieldCurve<Traits,Interpolator,Bootstrap> this_curve
private

Definition at line 67 of file piecewiseyieldcurve.hpp.

◆ traits_type

typedef Traits traits_type

Definition at line 69 of file piecewiseyieldcurve.hpp.

◆ interpolator_type

typedef Interpolator interpolator_type

Definition at line 70 of file piecewiseyieldcurve.hpp.

◆ bootstrap_type

typedef Bootstrap<this_curve> bootstrap_type

Definition at line 71 of file piecewiseyieldcurve.hpp.

Constructor & Destructor Documentation

◆ PiecewiseYieldCurve() [1/6]

PiecewiseYieldCurve ( const Date referenceDate,
std::vector< ext::shared_ptr< typename Traits::helper > >  instruments,
const DayCounter dayCounter,
const std::vector< Handle< Quote > > &  jumps = {},
const std::vector< Date > &  jumpDates = {},
const Interpolator &  i = {},
bootstrap_type  bootstrap = {} 
)

Definition at line 75 of file piecewiseyieldcurve.hpp.

◆ PiecewiseYieldCurve() [2/6]

PiecewiseYieldCurve ( const Date referenceDate,
std::vector< ext::shared_ptr< typename Traits::helper > >  instruments,
const DayCounter dayCounter,
const Interpolator &  i,
bootstrap_type  bootstrap = bootstrap_type() 
)

Definition at line 89 of file piecewiseyieldcurve.hpp.

◆ PiecewiseYieldCurve() [3/6]

PiecewiseYieldCurve ( const Date referenceDate,
std::vector< ext::shared_ptr< typename Traits::helper > >  instruments,
const DayCounter dayCounter,
bootstrap_type  bootstrap 
)

Definition at line 101 of file piecewiseyieldcurve.hpp.

◆ PiecewiseYieldCurve() [4/6]

PiecewiseYieldCurve ( Natural  settlementDays,
const Calendar calendar,
std::vector< ext::shared_ptr< typename Traits::helper > >  instruments,
const DayCounter dayCounter,
const std::vector< Handle< Quote > > &  jumps = {},
const std::vector< Date > &  jumpDates = {},
const Interpolator &  i = {},
bootstrap_type  bootstrap = {} 
)

Definition at line 112 of file piecewiseyieldcurve.hpp.

◆ PiecewiseYieldCurve() [5/6]

PiecewiseYieldCurve ( Natural  settlementDays,
const Calendar calendar,
std::vector< ext::shared_ptr< typename Traits::helper > >  instruments,
const DayCounter dayCounter,
const Interpolator &  i,
bootstrap_type  bootstrap = bootstrap_type() 
)

Definition at line 127 of file piecewiseyieldcurve.hpp.

◆ PiecewiseYieldCurve() [6/6]

PiecewiseYieldCurve ( Natural  settlementDays,
const Calendar calendar,
const std::vector< ext::shared_ptr< typename Traits::helper > > &  instruments,
const DayCounter dayCounter,
const bootstrap_type bootstrap 
)

Definition at line 144 of file piecewiseyieldcurve.hpp.

Member Function Documentation

◆ maxDate()

Date maxDate
override

Definition at line 198 of file piecewiseyieldcurve.hpp.

◆ times()

const std::vector< Time > & times

Definition at line 204 of file piecewiseyieldcurve.hpp.

◆ dates()

const std::vector< Date > & dates

Definition at line 210 of file piecewiseyieldcurve.hpp.

◆ data()

const std::vector< Real > & data

Definition at line 216 of file piecewiseyieldcurve.hpp.

◆ nodes()

std::vector< std::pair< Date, Real > > nodes

Definition at line 223 of file piecewiseyieldcurve.hpp.

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from LazyObject.

Definition at line 229 of file piecewiseyieldcurve.hpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprivatevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.

Definition at line 250 of file piecewiseyieldcurve.hpp.

◆ discountImpl()

DiscountFactor discountImpl ( Time  t) const
overrideprivate

Definition at line 244 of file piecewiseyieldcurve.hpp.

Friends And Related Function Documentation

◆ MultiCurveSensitivities

friend class MultiCurveSensitivities
friend

Definition at line 187 of file piecewiseyieldcurve.hpp.

◆ Bootstrap< this_curve >

friend class Bootstrap< this_curve >
friend

Definition at line 187 of file piecewiseyieldcurve.hpp.

◆ BootstrapError< this_curve >

friend class BootstrapError< this_curve >
friend

Definition at line 187 of file piecewiseyieldcurve.hpp.

◆ PenaltyFunction< this_curve >

friend class PenaltyFunction< this_curve >
friend

Definition at line 187 of file piecewiseyieldcurve.hpp.

Member Data Documentation

◆ instruments_

std::vector<ext::shared_ptr<typename Traits::helper> > instruments_
private

Definition at line 180 of file piecewiseyieldcurve.hpp.

◆ accuracy_

Real accuracy_
private

Definition at line 181 of file piecewiseyieldcurve.hpp.

◆ bootstrap_

Bootstrap<this_curve> bootstrap_
private

Definition at line 191 of file piecewiseyieldcurve.hpp.