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

Piecewise default-probability term structure. More...

#include <piecewisedefaultcurve.hpp>

+ Inheritance diagram for PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >:
+ Collaboration diagram for PiecewiseDefaultCurve< 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
 PiecewiseDefaultCurve (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={})
 
 PiecewiseDefaultCurve (const Date &referenceDate, const std::vector< ext::shared_ptr< typename Traits::helper > > &instruments, const DayCounter &dayCounter, const Interpolator &i, const bootstrap_type &bootstrap=bootstrap_type())
 
 PiecewiseDefaultCurve (const Date &referenceDate, std::vector< ext::shared_ptr< typename Traits::helper > > instruments, const DayCounter &dayCounter, bootstrap_type bootstrap)
 
 PiecewiseDefaultCurve (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={})
 
 PiecewiseDefaultCurve (Natural settlementDays, const Calendar &calendar, const std::vector< ext::shared_ptr< typename Traits::helper > > &instruments, const DayCounter &dayCounter, const Interpolator &i, const bootstrap_type &bootstrap=bootstrap_type())
 
 PiecewiseDefaultCurve (Natural settlementDays, const Calendar &calendar, const std::vector< ext::shared_ptr< typename Traits::helper > > &instruments, const DayCounter &dayCounter, const bootstrap_type &bootstrap)
 
 PiecewiseDefaultCurve (const Date &referenceDate, const std::vector< ext::shared_ptr< typename Traits::helper > > &instruments, const DayCounter &dayCounter, const ext::shared_ptr< OneFactorAffineModel > &model, const Interpolator &i={}, 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 PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap > this_curve
 

LazyObject interface

std::vector< ext::shared_ptr< typename Traits::helper > > instruments_
 
Real accuracy_
 
Bootstrap< this_curvebootstrap_
 
class Bootstrap< this_curve >
 
class BootstrapError< this_curve >
 
void performCalculations () const override
 
Probability survivalProbabilityImpl (Time) const override
 
Real defaultDensityImpl (Time) const override
 
Real hazardRateImpl (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::PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >

Piecewise default-probability term structure.

This term structure is bootstrapped on a number of credit instruments which are passed as a vector of handles to DefaultProbabilityHelper 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.
Examples
CDS.cpp.

Definition at line 55 of file piecewisedefaultcurve.hpp.

Member Typedef Documentation

◆ base_curve

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

Definition at line 59 of file piecewisedefaultcurve.hpp.

◆ this_curve

typedef PiecewiseDefaultCurve<Traits,Interpolator,Bootstrap> this_curve
private

Definition at line 60 of file piecewisedefaultcurve.hpp.

◆ traits_type

typedef Traits traits_type

Definition at line 62 of file piecewisedefaultcurve.hpp.

◆ interpolator_type

typedef Interpolator interpolator_type

Definition at line 63 of file piecewisedefaultcurve.hpp.

◆ bootstrap_type

typedef Bootstrap<this_curve> bootstrap_type

Definition at line 64 of file piecewisedefaultcurve.hpp.

Constructor & Destructor Documentation

◆ PiecewiseDefaultCurve() [1/7]

PiecewiseDefaultCurve ( 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 68 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [2/7]

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

Definition at line 82 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [3/7]

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

Definition at line 95 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [4/7]

PiecewiseDefaultCurve ( 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 106 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [5/7]

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

Definition at line 121 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [6/7]

PiecewiseDefaultCurve ( 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 135 of file piecewisedefaultcurve.hpp.

◆ PiecewiseDefaultCurve() [7/7]

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

Definition at line 157 of file piecewisedefaultcurve.hpp.

Member Function Documentation

◆ maxDate()

Date maxDate
override

Definition at line 215 of file piecewisedefaultcurve.hpp.

◆ times()

const std::vector< Time > & times

Definition at line 222 of file piecewisedefaultcurve.hpp.

◆ dates()

const std::vector< Date > & dates

Definition at line 229 of file piecewisedefaultcurve.hpp.

◆ data()

const std::vector< Real > & data

Definition at line 236 of file piecewisedefaultcurve.hpp.

◆ nodes()

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

Definition at line 243 of file piecewisedefaultcurve.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 249 of file piecewisedefaultcurve.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 280 of file piecewisedefaultcurve.hpp.

◆ survivalProbabilityImpl()

Probability survivalProbabilityImpl ( Time  t) const
overrideprivate

Definition at line 262 of file piecewisedefaultcurve.hpp.

◆ defaultDensityImpl()

Real defaultDensityImpl ( Time  t) const
overrideprivate

Definition at line 268 of file piecewisedefaultcurve.hpp.

◆ hazardRateImpl()

Real hazardRateImpl ( Time  t) const
overrideprivate

Definition at line 274 of file piecewisedefaultcurve.hpp.

Friends And Related Function Documentation

◆ Bootstrap< this_curve >

friend class Bootstrap< this_curve >
friend

Definition at line 200 of file piecewisedefaultcurve.hpp.

◆ BootstrapError< this_curve >

friend class BootstrapError< this_curve >
friend

Definition at line 200 of file piecewisedefaultcurve.hpp.

Member Data Documentation

◆ instruments_

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

Definition at line 199 of file piecewisedefaultcurve.hpp.

◆ accuracy_

Real accuracy_
private

Definition at line 200 of file piecewisedefaultcurve.hpp.

◆ bootstrap_

Bootstrap<this_curve> bootstrap_
private

Definition at line 208 of file piecewisedefaultcurve.hpp.