redemptions (3)  Linux Manuals
redemptions: Base bond class.
NAME
QuantLib::Bond  Base bond class.
SYNOPSIS
#include <ql/instruments/bond.hpp>
Inherits QuantLib::Instrument.
Inherited by AmortizingCmsRateBond, AmortizingFixedRateBond, AmortizingFloatingRateBond, CallableBond, CmsRateBond, ConvertibleBond, FixedRateBond, FloatingRateBond, and ZeroCouponBond.
Public Member Functions
Bond (Natural settlementDays, const Calendar &calendar, const Date &issueDate=Date(), const Leg &coupons=Leg())
constructor for amortizing or nonamortizing bonds.
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.
virtual Rate nextCoupon (Date d=Date()) const
Rate previousCoupon (Date d=Date()) const
Previous coupon already paid at a given date.
Inspectors
Natural settlementDays () const
const Calendar & calendar () const
Real faceAmount () const
const std::vector< Real > & notionals () const
virtual Real notional (Date d=Date()) const
const Leg & cashflows () const
const Leg & redemptions () const
const boost::shared_ptr< CashFlow > & redemption () const
Date maturityDate () const
Date issueDate () const
Date settlementDate (const Date &d=Date()) const
Calculations
Real cleanPrice () const
theoretical clean price
Real dirtyPrice () const
theoretical dirty price
Real settlementValue () const
theoretical settlement value
Rate yield (const DayCounter &dc, Compounding comp, Frequency freq, Real accuracy=1.0e8, Size maxEvaluations=100) const
theoretical bond yield
Real cleanPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
clean price given a yield and settlement date
Real dirtyPrice (Rate yield, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
dirty price given a yield and settlement date
Real settlementValue (Real cleanPrice) const
settlement value as a function of the clean price
Rate yield (Real cleanPrice, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date(), Real accuracy=1.0e8, Size maxEvaluations=100) const
yield given a (clean) price and settlement date
Real cleanPriceFromZSpread (Spread zSpread, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
clean price given Zspread
Real dirtyPriceFromZSpread (Spread zSpread, const DayCounter &dc, Compounding comp, Frequency freq, Date settlementDate=Date()) const
dirty price given Zspread
virtual Real accruedAmount (Date d=Date()) const
accrued amount at a given date
bool isExpired () const
returns whether the instrument is still tradable.
Protected Member Functions
void setupExpired () const
void setupArguments (PricingEngine::arguments *) const
void fetchResults (const PricingEngine::results *) const
void addRedemptionsToCashflows (const std::vector< Real > &redemptions=std::vector< Real >())
void calculateNotionalsFromCashflows ()
void setSingleRedemption (Real notional, Real redemption, const Date &date)
Protected Attributes
Natural settlementDays_
Calendar calendar_
std::vector< Date > notionalSchedule_
std::vector< Real > notionals_
Leg cashflows_
Leg redemptions_
Date maturityDate_
Date issueDate_
Real settlementValue_
Detailed Description
Base bond class.
Derived classes must fill the uninitialized data members.
Warning
 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,
Tests

 *
 price/yield calculations are crosschecked for consistency.
 *
 price/yield calculations are checked against known good values.
Constructor & Destructor Documentation
Bond (Natural settlementDays, const Calendar & calendar, const Date & issueDate = Date(), const Leg & coupons = Leg())
constructor for amortizing or nonamortizing bonds.
Redemptions and maturity are calculated from the coupon data, if available. Therefore, redemptions must not be included in the passed cash flows.
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.
Warning
 The last passed cash flow must be the bond redemption. No other cash flow can have a date later than the redemption date.
Member Function Documentation
const Leg & cashflows () const
Note:
 returns all the cashflows, including the redemptions.
const Leg & redemptions () const
returns just the redemption flows (not interest payments)
const boost::shared_ptr<CashFlow>& redemption () const
returns the redemption, if only one is defined
Real cleanPrice () const
theoretical clean price
The default bond settlement is used for calculation.
Warning
 the theoretical price calculated from a flat term structure might differ slightly from the price calculated from the corresponding yield by means of the other overload of this function. If the price from a constant yield is desired, it is advisable to use such other overload.
Real dirtyPrice () const
theoretical dirty price
The default bond settlement is used for calculation.
Warning
 the theoretical price calculated from a flat term structure might differ slightly from the price calculated from the corresponding yield by means of the other overload of this function. If the price from a constant yield is desired, it is advisable to use such other overload.
Real settlementValue () const
theoretical settlement value
The default bond settlement date is used for calculation.
Rate yield (const DayCounter & dc, Compounding comp, Frequency freq, Real accuracy = 1.0e8, Size maxEvaluations = 100) const
theoretical bond yield
The default bond settlement and theoretical price are used for calculation.
Real cleanPrice (Rate yield, const DayCounter & dc, Compounding comp, Frequency freq, Date settlementDate = Date()) const
clean price given a yield and settlement date
The default bond settlement is used if no date is given.
Real dirtyPrice (Rate yield, const DayCounter & dc, Compounding comp, Frequency freq, Date settlementDate = Date()) const
dirty price given a yield and settlement date
The default bond settlement is used if no date is given.
Real settlementValue (Real cleanPrice) const
settlement value as a function of the clean price
The default bond settlement date is used for calculation.
Rate yield (Real cleanPrice, const DayCounter & dc, Compounding comp, Frequency freq, Date settlementDate = Date(), Real accuracy = 1.0e8, Size maxEvaluations = 100) const
yield given a (clean) price and settlement date
The default bond settlement is used if no date is given.
Real cleanPriceFromZSpread (Spread zSpread, const DayCounter & dc, Compounding comp, Frequency freq, Date settlementDate = Date()) const
clean price given Zspread
Zspread compounding, frequency, daycount are taken into account The default bond settlement is used if no date is given. For details on Zspread refer to: 'Credit Spreads Explained', Lehman Brothers European Fixed Income Research  March 2004, D. O'Kane
Real dirtyPriceFromZSpread (Spread zSpread, const DayCounter & dc, Compounding comp, Frequency freq, Date settlementDate = Date()) const
dirty price given Zspread
Zspread compounding, frequency, daycount are taken into account The default bond settlement is used if no date is given. For details on Zspread refer to: 'Credit Spreads Explained', Lehman Brothers European Fixed Income Research  March 2004, D. O'Kane
virtual Real accruedAmount (Date d = Date()) const [virtual]
accrued amount at a given date
The default bond settlement is used if no date is given.
virtual Rate nextCoupon (Date d = Date()) const [virtual]
Expected next coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the alreadyfixed notyetpaid one.
The current bond settlement is used if no date is given.
Rate previousCoupon (Date d = Date()) const
Previous coupon already paid at a given date.
Expected previous coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the last paid one.
The current bond settlement is used if no date is given.
void setupExpired () const [protected, virtual]
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from Instrument.
void setupArguments (PricingEngine::arguments *) const [protected, virtual]
When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument.
Reimplemented in CallableBond, and CallableFixedRateBond.
void fetchResults (const PricingEngine::results * r) const [protected, virtual]
When a derived result structure is defined for an instrument, this method should be overridden to read from it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument.
void addRedemptionsToCashflows (const std::vector< Real > & redemptions = std::vector< Real >()) [protected]
This method can be called by derived classes in order to build redemption payments from the existing cash flows. It must be called after setting up the cashflows_ vector and will fill the notionalSchedule_, notionals_, and redemptions_ data members.
If given, the elements of the redemptions vector will multiply the amount of the redemption cash flow. The elements will be taken in base 100, i.e., a redemption equal to 100 does not modify the amount.
Precondition:
 The cashflows_ vector must contain at least one coupon and must be sorted by date.
void setSingleRedemption (Real notional, Real redemption, const Date & date) [protected]
This method can be called by derived classes in order to build a bond with a single redemption payment. It will fill the notionalSchedule_, notionals_, and redemptions_ data members.
Author
Generated automatically by Doxygen for QuantLib from the source code.