QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
List of all members
BondFunctions Struct Reference

Bond adapters of CashFlows functions. More...

#include <bondfunctions.hpp>

+ Collaboration diagram for BondFunctions:

Static Public Member Functions

Date inspectors
static Date startDate (const Bond &bond)
 
static Date maturityDate (const Bond &bond)
 
static bool isTradable (const Bond &bond, Date settlementDate=Date())
 
CashFlow inspectors
static Leg::const_reverse_iterator previousCashFlow (const Bond &bond, Date refDate=Date())
 
static Leg::const_iterator nextCashFlow (const Bond &bond, Date refDate=Date())
 
static Date previousCashFlowDate (const Bond &bond, Date refDate=Date())
 
static Date nextCashFlowDate (const Bond &bond, Date refDate=Date())
 
static Real previousCashFlowAmount (const Bond &bond, Date refDate=Date())
 
static Real nextCashFlowAmount (const Bond &bond, Date refDate=Date())
 
Coupon inspectors
static Rate previousCouponRate (const Bond &bond, Date settlementDate=Date())
 
static Rate nextCouponRate (const Bond &bond, Date settlementDate=Date())
 
static Date accrualStartDate (const Bond &bond, Date settlementDate=Date())
 
static Date accrualEndDate (const Bond &bond, Date settlementDate=Date())
 
static Date referencePeriodStart (const Bond &bond, Date settlementDate=Date())
 
static Date referencePeriodEnd (const Bond &bond, Date settlementDate=Date())
 
static Time accrualPeriod (const Bond &bond, Date settlementDate=Date())
 
static Date::serial_type accrualDays (const Bond &bond, Date settlementDate=Date())
 
static Time accruedPeriod (const Bond &bond, Date settlementDate=Date())
 
static Date::serial_type accruedDays (const Bond &bond, Date settlementDate=Date())
 
static Real accruedAmount (const Bond &bond, Date settlementDate=Date())
 
YieldTermStructure functions
static Real cleanPrice (const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
 
static Real dirtyPrice (const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
 
static Real bps (const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
 
static Rate atmRate (const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date(), Bond::Price price={})
 
Yield (a.k.a. Internal Rate of Return, i.e. IRR) functions
static Real cleanPrice (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real cleanPrice (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Real dirtyPrice (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real dirtyPrice (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Real bps (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real bps (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Rate yield (const Bond &bond, Bond::Price price, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.05)
 
template<typename Solver >
static Rate yield (const Solver &solver, const Bond &bond, Bond::Price price, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date(), Real accuracy=1.0e-10, Rate guess=0.05)
 
static Time duration (const Bond &bond, const InterestRate &yield, Duration::Type type=Duration::Modified, Date settlementDate=Date())
 
static Time duration (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Duration::Type type=Duration::Modified, Date settlementDate=Date())
 
static Real convexity (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real convexity (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Real basisPointValue (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real basisPointValue (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Real yieldValueBasisPoint (const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
 
static Real yieldValueBasisPoint (const Bond &bond, Rate yield, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
Z-spread functions
static Real cleanPrice (const Bond &bond, const ext::shared_ptr< YieldTermStructure > &discount, Spread zSpread, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Real dirtyPrice (const Bond &bond, const ext::shared_ptr< YieldTermStructure > &discount, Spread zSpread, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date())
 
static Spread zSpread (const Bond &bond, Bond::Price price, const ext::shared_ptr< YieldTermStructure > &, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.0)
 

Detailed Description

Bond adapters of CashFlows functions.

See CashFlows for functions' documentation.

These adapters calls into CashFlows functions passing as input the Bond cashflows, the dirty price (i.e. npv) calculated from clean price, the bond settlement date (unless another date is given), zero ex-dividend days, and excluding any cashflow on the settlement date.

Prices are always clean, as per market convention.

Definition at line 54 of file bondfunctions.hpp.

Member Function Documentation

◆ startDate()

Date startDate ( const Bond bond)
static

Definition at line 31 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maturityDate()

Date maturityDate ( const Bond bond)
static

Definition at line 35 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTradable()

bool isTradable ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 39 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ previousCashFlow()

Leg::const_reverse_iterator previousCashFlow ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 48 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ nextCashFlow()

Leg::const_iterator nextCashFlow ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 57 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ previousCashFlowDate()

Date previousCashFlowDate ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 66 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nextCashFlowDate()

Date nextCashFlowDate ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 75 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ previousCashFlowAmount()

Real previousCashFlowAmount ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 84 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ nextCashFlowAmount()

Real nextCashFlowAmount ( const Bond bond,
Date  refDate = Date() 
)
static

Definition at line 93 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ previousCouponRate()

Rate previousCouponRate ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 102 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nextCouponRate()

Rate nextCouponRate ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 111 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accrualStartDate()

Date accrualStartDate ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 120 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accrualEndDate()

Date accrualEndDate ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 133 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ referencePeriodStart()

Date referencePeriodStart ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 146 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ referencePeriodEnd()

Date referencePeriodEnd ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 159 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accrualPeriod()

Time accrualPeriod ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 172 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accrualDays()

Date::serial_type accrualDays ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 185 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accruedPeriod()

Time accruedPeriod ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 198 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accruedDays()

Date::serial_type accruedDays ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 211 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ accruedAmount()

Real accruedAmount ( const Bond bond,
Date  settlementDate = Date() 
)
static

Definition at line 224 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanPrice() [1/4]

Real cleanPrice ( const Bond bond,
const YieldTermStructure discountCurve,
Date  settlementDate = Date() 
)
static

Definition at line 239 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dirtyPrice() [1/4]

Real dirtyPrice ( const Bond bond,
const YieldTermStructure discountCurve,
Date  settlementDate = Date() 
)
static

Definition at line 248 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bps() [1/3]

Real bps ( const Bond bond,
const YieldTermStructure discountCurve,
Date  settlementDate = Date() 
)
static

Definition at line 265 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ atmRate()

Rate atmRate ( const Bond bond,
const YieldTermStructure discountCurve,
Date  settlementDate = Date(),
Bond::Price  price = {} 
)
static

Definition at line 280 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ cleanPrice() [2/4]

Real cleanPrice ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 306 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ cleanPrice() [3/4]

Real cleanPrice ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 312 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ dirtyPrice() [2/4]

Real dirtyPrice ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 322 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ dirtyPrice() [3/4]

Real dirtyPrice ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 338 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ bps() [2/3]

Real bps ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 348 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ bps() [3/3]

Real bps ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 363 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ yield() [1/2]

Rate yield ( const Bond bond,
Bond::Price  price,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date(),
Real  accuracy = 1.0e-10,
Size  maxIterations = 100,
Rate  guess = 0.05 
)
static

Definition at line 373 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yield() [2/2]

static Rate yield ( const Solver &  solver,
const Bond bond,
Bond::Price  price,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date(),
Real  accuracy = 1.0e-10,
Rate  guess = 0.05 
)
static

Definition at line 163 of file bondfunctions.hpp.

+ Here is the call graph for this function:

◆ duration() [1/2]

Time duration ( const Bond bond,
const InterestRate yield,
Duration::Type  type = Duration::Modified,
Date  settlementDate = Date() 
)
static

Definition at line 389 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duration() [2/2]

Time duration ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Duration::Type  type = Duration::Modified,
Date  settlementDate = Date() 
)
static

Definition at line 405 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ convexity() [1/2]

Real convexity ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 416 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convexity() [2/2]

Real convexity ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 430 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ basisPointValue() [1/2]

Real basisPointValue ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 440 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ basisPointValue() [2/2]

Real basisPointValue ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 454 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ yieldValueBasisPoint() [1/2]

Real yieldValueBasisPoint ( const Bond bond,
const InterestRate yield,
Date  settlementDate = Date() 
)
static

Definition at line 464 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yieldValueBasisPoint() [2/2]

Real yieldValueBasisPoint ( const Bond bond,
Rate  yield,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 478 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ cleanPrice() [4/4]

Real cleanPrice ( const Bond bond,
const ext::shared_ptr< YieldTermStructure > &  discount,
Spread  zSpread,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 488 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ dirtyPrice() [4/4]

Real dirtyPrice ( const Bond bond,
const ext::shared_ptr< YieldTermStructure > &  discount,
Spread  zSpread,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date() 
)
static

Definition at line 501 of file bondfunctions.cpp.

+ Here is the call graph for this function:

◆ zSpread()

Spread zSpread ( const Bond bond,
Bond::Price  price,
const ext::shared_ptr< YieldTermStructure > &  d,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency,
Date  settlementDate = Date(),
Real  accuracy = 1.0e-10,
Size  maxIterations = 100,
Rate  guess = 0.0 
)
static

Definition at line 522 of file bondfunctions.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: