27#ifndef quantlib_bond_functions_hpp
28#define quantlib_bond_functions_hpp
42 class YieldTermStructure;
65 static Leg::const_reverse_iterator
159 Real accuracy = 1.0e-10,
160 Size maxIterations = 100,
162 template <
typename Solver>
170 Real accuracy = 1.0e-10,
172 if (settlementDate ==
Date())
176 "non tradable at " << settlementDate <<
184 amount /= 100.0 / bond.
notional(settlementDate);
186 return CashFlows::yield<Solver>(solver, bond.
cashflows(), amount, dayCounter,
188 frequency,
false, settlementDate,
189 settlementDate, accuracy, guess);
234 const ext::shared_ptr<YieldTermStructure>& discount,
241 const ext::shared_ptr<YieldTermStructure>& discount,
249 const ext::shared_ptr<YieldTermStructure>&,
254 Real accuracy = 1.0e-10,
255 Size maxIterations = 100,
Base class for cash flows.
Cash-flow analysis functions.
virtual Real accruedAmount(Date d=Date()) const
accrued amount at a given date
const Leg & cashflows() const
Date maturityDate() const
virtual Real notional(Date d=Date()) const
Date settlementDate(Date d=Date()) const
std::int_fast32_t serial_type
serial number type
Concrete interest rate class.
Interest-rate term structure.
Duration type enumeration.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
Real Time
continuous quantity with 1-year units
Real Spread
spreads on interest rates
std::size_t Size
size of a container
Compounding
Interest rate coumpounding rule.
Maps shared_ptr to either the boost or std implementation.
Bond adapters of CashFlows functions.
static Real yieldValueBasisPoint(const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
static Leg::const_iterator nextCashFlow(const Bond &bond, Date refDate=Date())
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 Leg::const_reverse_iterator previousCashFlow(const Bond &bond, Date refDate=Date())
static Rate atmRate(const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date(), Bond::Price price={})
static Rate nextCouponRate(const Bond &bond, Date settlementDate=Date())
static Date startDate(const Bond &bond)
static Date referencePeriodStart(const Bond &bond, Date settlementDate=Date())
static bool isTradable(const Bond &bond, Date settlementDate=Date())
static Real bps(const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
static Date maturityDate(const Bond &bond)
static Date::serial_type accruedDays(const Bond &bond, Date settlementDate=Date())
static Real dirtyPrice(const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
static Date previousCashFlowDate(const Bond &bond, Date refDate=Date())
static Real nextCashFlowAmount(const Bond &bond, Date refDate=Date())
static Real convexity(const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
static Real basisPointValue(const Bond &bond, const InterestRate &yield, Date settlementDate=Date())
static Date::serial_type accrualDays(const Bond &bond, Date settlementDate=Date())
static Date nextCashFlowDate(const Bond &bond, Date refDate=Date())
static Date referencePeriodEnd(const Bond &bond, 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)
static Real accruedAmount(const Bond &bond, Date settlementDate=Date())
static Date accrualStartDate(const Bond &bond, Date settlementDate=Date())
static Real cleanPrice(const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate=Date())
static Rate previousCouponRate(const Bond &bond, Date settlementDate=Date())
static Date accrualEndDate(const Bond &bond, 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)
static Time duration(const Bond &bond, const InterestRate &yield, Duration::Type type=Duration::Modified, Date settlementDate=Date())
static Time accruedPeriod(const Bond &bond, Date settlementDate=Date())
static Time accrualPeriod(const Bond &bond, Date settlementDate=Date())
static Real previousCashFlowAmount(const Bond &bond, Date refDate=Date())