QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
CPIBond Class Reference

#include <cpibond.hpp>

+ Inheritance diagram for CPIBond:
+ Collaboration diagram for CPIBond:

Public Member Functions

 CPIBond (Natural settlementDays, Real faceAmount, bool growthOnly, Real baseCPI, const Period &observationLag, ext::shared_ptr< ZeroInflationIndex > cpiIndex, CPI::InterpolationType observationInterpolation, Schedule schedule, const std::vector< Rate > &coupons, const DayCounter &accrualDayCounter, BusinessDayConvention paymentConvention=ModifiedFollowing, const Date &issueDate=Date(), const Calendar &paymentCalendar=Calendar(), const Period &exCouponPeriod=Period(), const Calendar &exCouponCalendar=Calendar(), BusinessDayConvention exCouponConvention=Unadjusted, bool exCouponEndOfMonth=false)
 
Frequency frequency () const
 
const DayCounterdayCounter () const
 
bool growthOnly () const
 
Real baseCPI () const
 
Period observationLag () const
 
const ext::shared_ptr< ZeroInflationIndex > & cpiIndex () const
 
CPI::InterpolationType observationInterpolation () const
 
- Public Member Functions inherited from Bond
 Bond (Natural settlementDays, Calendar calendar, const Date &issueDate=Date(), const Leg &coupons=Leg())
 constructor for amortizing or non-amortizing bonds. More...
 
 Bond (Natural settlementDays, Calendar calendar, Real faceAmount, const Date &maturityDate, const Date &issueDate=Date(), const Leg &cashflows=Leg())
 old constructor for non amortizing bonds. More...
 
bool isExpired () const override
 returns whether the instrument might have value greater than zero. More...
 
void deepUpdate () override
 
Natural settlementDays () const
 
const Calendarcalendar () const
 
const std::vector< Real > & notionals () const
 
virtual Real notional (Date d=Date()) const
 
const Legcashflows () const
 
const Legredemptions () const
 
const ext::shared_ptr< CashFlow > & redemption () const
 
Date startDate () const
 
Date maturityDate () const
 
Date issueDate () const
 
bool isTradable (Date d=Date()) const
 
Date settlementDate (Date d=Date()) const
 
Real cleanPrice () const
 theoretical clean price More...
 
Real dirtyPrice () const
 theoretical dirty price More...
 
Real settlementValue () const
 theoretical settlement value More...
 
Rate yield (const DayCounter &dc, Compounding comp, Frequency freq, Real accuracy=1.0e-8, Size maxEvaluations=100, Real guess=0.05, Bond::Price::Type priceType=Bond::Price::Clean) const
 theoretical bond yield More...
 
Real cleanPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
 clean price given a yield and settlement date More...
 
Real dirtyPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
 dirty price given a yield and settlement date More...
 
Real settlementValue (Real cleanPrice) const
 settlement value as a function of the clean price More...
 
Rate yield (Real price, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date(), Real accuracy=1.0e-8, Size maxEvaluations=100, Real guess=0.05, Bond::Price::Type priceType=Bond::Price::Clean) const
 
Rate yield (Bond::Price price, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date(), Real accuracy=1.0e-8, Size maxEvaluations=100, Real guess=0.05) const
 yield given a price and settlement date More...
 
virtual Real accruedAmount (Date d=Date()) const
 accrued amount at a given date More...
 
virtual Rate nextCouponRate (Date d=Date()) const
 
Rate previousCouponRate (Date d=Date()) const
 Previous coupon already paid at a given date. More...
 
Date nextCashFlowDate (Date d=Date()) const
 
Date previousCashFlowDate (Date d=Date()) const
 
- Public Member Functions inherited from Instrument
 Instrument ()
 
Real NPV () const
 returns the net present value of the instrument. More...
 
Real errorEstimate () const
 returns the error estimate on the NPV when available. More...
 
const DatevaluationDate () const
 returns the date the net present value refers to. More...
 
template<typename T >
T result (const std::string &tag) const
 returns any additional result returned by the pricing engine. More...
 
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used. More...
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
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 ()
 

Protected Attributes

Frequency frequency_
 
DayCounter dayCounter_
 
bool growthOnly_
 
Real baseCPI_
 
Period observationLag_
 
ext::shared_ptr< ZeroInflationIndexcpiIndex_
 
CPI::InterpolationType observationInterpolation_
 
- Protected Attributes inherited from Bond
Natural settlementDays_
 
Calendar calendar_
 
std::vector< DatenotionalSchedule_
 
std::vector< Realnotionals_
 
Leg cashflows_
 
Leg redemptions_
 
Date maturityDate_
 
Date issueDate_
 
Real settlementValue_
 
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, ext::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Bond
void setupExpired () const override
 
void setupArguments (PricingEngine::arguments *) const override
 
void fetchResults (const PricingEngine::results *) const override
 
void addRedemptionsToCashflows (const std::vector< Real > &redemptions=std::vector< Real >())
 
void setSingleRedemption (Real notional, Real redemption, const Date &date)
 
void setSingleRedemption (Real notional, const ext::shared_ptr< CashFlow > &redemption)
 
void calculateNotionalsFromCashflows ()
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject

Detailed Description

cpi bond; if there is only one date in the schedule it is a zero bond returning an inflated notional.

Definition at line 43 of file cpibond.hpp.

Constructor & Destructor Documentation

◆ CPIBond()

CPIBond ( Natural  settlementDays,
Real  faceAmount,
bool  growthOnly,
Real  baseCPI,
const Period observationLag,
ext::shared_ptr< ZeroInflationIndex cpiIndex,
CPI::InterpolationType  observationInterpolation,
Schedule  schedule,
const std::vector< Rate > &  coupons,
const DayCounter accrualDayCounter,
BusinessDayConvention  paymentConvention = ModifiedFollowing,
const Date issueDate = Date(),
const Calendar paymentCalendar = Calendar(),
const Period exCouponPeriod = Period(),
const Calendar exCouponCalendar = Calendar(),
BusinessDayConvention  exCouponConvention = Unadjusted,
bool  exCouponEndOfMonth = false 
)

Definition at line 36 of file cpibond.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ frequency()

Frequency frequency ( ) const

Definition at line 63 of file cpibond.hpp.

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Definition at line 64 of file cpibond.hpp.

◆ growthOnly()

bool growthOnly ( ) const

Definition at line 65 of file cpibond.hpp.

◆ baseCPI()

Real baseCPI ( ) const

Definition at line 66 of file cpibond.hpp.

◆ observationLag()

Period observationLag ( ) const

Definition at line 67 of file cpibond.hpp.

◆ cpiIndex()

const ext::shared_ptr< ZeroInflationIndex > & cpiIndex ( ) const

Definition at line 68 of file cpibond.hpp.

◆ observationInterpolation()

CPI::InterpolationType observationInterpolation ( ) const

Definition at line 69 of file cpibond.hpp.

Member Data Documentation

◆ frequency_

Frequency frequency_
protected

Definition at line 72 of file cpibond.hpp.

◆ dayCounter_

DayCounter dayCounter_
protected

Definition at line 73 of file cpibond.hpp.

◆ growthOnly_

bool growthOnly_
protected

Definition at line 74 of file cpibond.hpp.

◆ baseCPI_

Real baseCPI_
protected

Definition at line 75 of file cpibond.hpp.

◆ observationLag_

Period observationLag_
protected

Definition at line 76 of file cpibond.hpp.

◆ cpiIndex_

ext::shared_ptr<ZeroInflationIndex> cpiIndex_
protected

Definition at line 77 of file cpibond.hpp.

◆ observationInterpolation_

CPI::InterpolationType observationInterpolation_
protected

Definition at line 78 of file cpibond.hpp.