QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Callable bond base class. More...
#include <callablebond.hpp>
Classes | |
class | arguments |
class | engine |
base class for callable fixed rate bond engine More... | |
class | results |
results for a callable bond calculation More... | |
Public Member Functions | |
Inspectors | |
const CallabilitySchedule & | callability () const |
return the bond's put/call schedule More... | |
![]() | |
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 Calendar & | calendar () const |
const std::vector< Real > & | notionals () const |
virtual Real | notional (Date d=Date()) const |
const Leg & | cashflows () const |
const Leg & | redemptions () 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 |
![]() | |
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 Date & | valuationDate () 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... | |
![]() | |
LazyObject () | |
~LazyObject () override=default | |
void | update () override |
bool | isCalculated () const |
void | forwardFirstNotificationOnly () |
void | alwaysForwardNotifications () |
void | recalculate () |
void | freeze () |
void | unfreeze () |
![]() | |
Observable () | |
Observable (const Observable &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
![]() | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (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 () |
Additional Inherited Members | |
![]() | |
typedef set_type::iterator | iterator |
![]() | |
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 () |
![]() | |
void | calculate () const override |
void | performCalculations () const override |
![]() | |
![]() | |
Natural | settlementDays_ |
Calendar | calendar_ |
std::vector< Date > | notionalSchedule_ |
std::vector< Real > | notionals_ |
Leg | cashflows_ |
Leg | redemptions_ |
Date | maturityDate_ |
Date | issueDate_ |
Real | settlementValue_ |
![]() | |
Real | NPV_ |
Real | errorEstimate_ |
Date | valuationDate_ |
std::map< std::string, ext::any > | additionalResults_ |
ext::shared_ptr< PricingEngine > | engine_ |
![]() | |
bool | calculated_ = false |
bool | frozen_ = false |
bool | alwaysForward_ |
Callable bond base class.
Base callable bond class for fixed and zero coupon bonds. Defines commonalities between fixed and zero coupon callable bonds. At present, only European and Bermudan put/call schedules supported (no American optionality), as defined by the Callability class.
Definition at line 53 of file callablebond.hpp.
|
protected |
const CallabilitySchedule & callability | ( | ) | const |
return the bond's put/call schedule
Definition at line 62 of file callablebond.hpp.
Volatility impliedVolatility | ( | const Bond::Price & | targetPrice, |
const Handle< YieldTermStructure > & | discountCurve, | ||
Real | accuracy, | ||
Size | maxEvaluations, | ||
Volatility | minVol, | ||
Volatility | maxVol | ||
) | const |
returns the Black implied forward yield volatility
the forward yield volatility, see Hull, Fourth Edition, Chapter 20, pg 536). Relevant only to European put/call schedules
Definition at line 112 of file callablebond.cpp.
Spread OAS | ( | Real | cleanPrice, |
const Handle< YieldTermStructure > & | engineTS, | ||
const DayCounter & | dayCounter, | ||
Compounding | compounding, | ||
Frequency | frequency, | ||
Date | settlementDate = Date() , |
||
Real | accuracy = 1.0e-10 , |
||
Size | maxIterations = 100 , |
||
Rate | guess = 0.0 |
||
) |
Calculate the Option Adjusted Spread (OAS)
Calculates the spread that needs to be added to the reference curve so that the theoretical model value matches the marketPrice.
Definition at line 279 of file callablebond.cpp.
Real cleanPriceOAS | ( | Real | oas, |
const Handle< YieldTermStructure > & | engineTS, | ||
const DayCounter & | dayCounter, | ||
Compounding | compounding, | ||
Frequency | frequency, | ||
Date | settlementDate = Date() |
||
) |
Calculate the clean price based on the given option-adjust-spread (oas) over the given yield term structure (engineTS)
Definition at line 313 of file callablebond.cpp.
Real effectiveDuration | ( | Real | oas, |
const Handle< YieldTermStructure > & | engineTS, | ||
const DayCounter & | dayCounter, | ||
Compounding | compounding, | ||
Frequency | frequency, | ||
Real | bump = 2e-4 |
||
) |
Calculate the effective duration, i.e., the first differential of the dirty price w.r.t. a parallel shift of the yield term structure divided by current dirty price
Definition at line 337 of file callablebond.cpp.
Real effectiveConvexity | ( | Real | oas, |
const Handle< YieldTermStructure > & | engineTS, | ||
const DayCounter & | dayCounter, | ||
Compounding | compounding, | ||
Frequency | frequency, | ||
Real | bump = 2e-4 |
||
) |
Calculate the effective convexity, i.e., the second differential of the dirty price w.r.t. a parallel shift of the yield term structure divided by current dirty price
Definition at line 369 of file callablebond.cpp.
|
overridevirtual |
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.
Definition at line 403 of file callablebond.cpp.
Definition at line 461 of file callablebond.cpp.
|
protected |
Definition at line 140 of file callablebond.hpp.
|
protected |
Definition at line 141 of file callablebond.hpp.
|
protected |
Definition at line 142 of file callablebond.hpp.
|
protected |
Definition at line 143 of file callablebond.hpp.