Logo
Reference manual - version qle_version
PriceTermStructureAdapter Class Reference

Adapter class for turning a PriceTermStructure in to a YieldTermStructure. More...

#include <qle/termstructures/pricetermstructureadapter.hpp>

Inheritance diagram for PriceTermStructureAdapter:

Public Member Functions

 PriceTermStructureAdapter (const QuantLib::ext::shared_ptr< PriceTermStructure > &priceCurve, const QuantLib::ext::shared_ptr< QuantLib::YieldTermStructure > &discount, QuantLib::Natural spotDays=0, const QuantLib::Calendar &spotCalendar=QuantLib::NullCalendar())
 PriceTermStructureAdapter (const QuantLib::ext::shared_ptr< PriceTermStructure > &priceCurve, const QuantLib::ext::shared_ptr< QuantLib::YieldTermStructure > &discount, const QuantLib::Handle< QuantLib::Quote > &spotQuote)
TermStructure interface
QuantLib::Date maxDate () const override
const QuantLib::Date & referenceDate () const override
QuantLib::DayCounter dayCounter () const override
Inspectors
const QuantLib::ext::shared_ptr< PriceTermStructure > & priceCurve () const
const QuantLib::ext::shared_ptr< QuantLib::YieldTermStructure > & discount () const
QuantLib::Natural spotDays () const
const QuantLib::Calendar & spotCalendar () const

YieldTermStructure interface

QuantLib::DiscountFactor discountImpl (QuantLib::Time t) const override

Detailed Description

Adapter class for turning a PriceTermStructure in to a YieldTermStructure.

This class takes a price term structure and an input yield curve and constructs a yield curve such that the discount factor \( P_p(0, t) \) at time \( t \) is given by:

\[P_p(0, t) = \exp(-s(t) t) \]

where \( s(t) \) is defined by:

\[\Pi(0, t) = S(0) \exp((z(t) - s(t)) t) \]

Here, \( \Pi(0, t) \) is the forward price of the underlying from the input price curve, \( S(0) \) is its spot price and \( z(t) \) is the continuously compounded zero rate from the input yield curve. The spot price is determined from the price curve at time 0 by default. There are optional parameters that allow using a price at a time other than 0 for the spot price.