Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

QuantLib::Bond Class Reference

#include <bond.hpp>

Inheritance diagram for QuantLib::Bond:

QuantLib::Instrument QuantLib::LazyObject QuantLib::Observable QuantLib::Observer QuantLib::AmortizingCmsRateBond QuantLib::AmortizingFixedRateBond QuantLib::AmortizingFloatingRateBond QuantLib::CallableBond QuantLib::CmsRateBond QuantLib::ConvertibleBond QuantLib::FixedRateBond QuantLib::FloatingRateBond QuantLib::ZeroCouponBond

List of all members.

Detailed Description

Base bond class.

Derived classes must fill the uninitialized data members.

Most methods assume that the cash flows are stored sorted by date, the redemption(s) being after any cash flow at the same date. In particular, if there's one single redemption, it must be the last cash flow,
  • price/yield calculations are cross-checked for consistency.
  • price/yield calculations are checked against known good values.

Definition at line 59 of file bond.hpp.

Public Member Functions

 Bond (Natural settlementDays, const Calendar &calendar, Real faceAmount, const Date &maturityDate, const Date &issueDate=Date(), const Leg &cashflows=Leg())
 old constructor for non amortizing bonds.
 Bond (Natural settlementDays, const Calendar &calendar, const Date &issueDate=Date(), const Leg &coupons=Leg())
 constructor for amortizing or non-amortizing bonds.
Date nextCashFlowDate (Date d=Date()) const
virtual Rate nextCouponRate (Date d=Date()) const
void notifyObservers ()
Date previousCashFlowDate (Date d=Date()) const
Rate previousCouponRate (Date d=Date()) const
 Previous coupon already paid at a given date.
void registerWith (const boost::shared_ptr< Observable > &)
void unregisterWith (const boost::shared_ptr< Observable > &)
virtual Real accruedAmount (Date d=Date()) const
 accrued amount at a given date
Real cleanPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
 clean price given a yield and settlement date
Real cleanPrice () const
 theoretical clean price
Real dirtyPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
 dirty price given a yield and settlement date
Real dirtyPrice () const
 theoretical dirty price
Real settlementValue (Real cleanPrice) const
 settlement value as a function of the clean price
Real settlementValue () const
 theoretical settlement value
Rate yield (Real cleanPrice, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date(), Real accuracy=1.0e-8, Size maxEvaluations=100) const
 yield given a (clean) price and settlement date
Rate yield (const DayCounter &dc, Compounding comp, Frequency freq, Real accuracy=1.0e-8, Size maxEvaluations=100) const
 theoretical bond yield
const std::map< std::string,
boost::any > & 
additionalResults () const
 returns all additional result returned by the pricing engine.
Real errorEstimate () const
 returns the error estimate on the NPV when available.
Real NPV () const
 returns the net present value of the instrument.
template<typename T>
result (const std::string &tag) const
 returns any additional result returned by the pricing engine.
const DatevaluationDate () const
 returns the date the net present value refers to.
const Calendarcalendar () const
const Leg & cashflows () const
Date issueDate () const
bool isTradable (Date d=Date()) const
Date maturityDate () const
virtual Real notional (Date d=Date()) const
const std::vector< Real > & notionals () const
const boost::shared_ptr
< CashFlow > & 
redemption () const
const Leg & redemptions () const
Date settlementDate (Date d=Date()) const
Natural settlementDays () const
These methods do not modify the structure of the object and are therefore declared as const. Data members which will be calculated on demand need to be declared as mutable.

void freeze ()
void recalculate ()
void unfreeze ()
Instrument interface
bool isExpired () const
 returns whether the instrument might have value greater than zero.
void setPricingEngine (const boost::shared_ptr< PricingEngine > &)
 set the pricing engine to be used.
Observer interface
void update ()

Protected Member Functions

void addRedemptionsToCashflows (const std::vector< Real > &redemptions=std::vector< Real >())
void calculateNotionalsFromCashflows ()
void fetchResults (const PricingEngine::results *) const
void setSingleRedemption (Real notional, const boost::shared_ptr< CashFlow > &redemption)
void setSingleRedemption (Real notional, Real redemption, const Date &date)
void setupArguments (PricingEngine::arguments *) const
void setupExpired () const
void calculate () const
virtual void performCalculations () const

Protected Attributes

bool calculated_
Calendar calendar_
Leg cashflows_
boost::shared_ptr< PricingEngineengine_
bool frozen_
Date issueDate_
Date maturityDate_
std::vector< Realnotionals_
std::vector< DatenotionalSchedule_
Leg redemptions_
Natural settlementDays_
Real settlementValue_
The value of this attribute and any other that derived classes might declare must be set during calculation.

std::map< std::string, boost::any > additionalResults_
Real errorEstimate_
Real NPV_
Date valuationDate_


class  arguments
class  engine
class  results

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index