27#ifndef quantlib_bond_functions_hpp
28#define quantlib_bond_functions_hpp
42 class YieldTermStructure;
65 static Leg::const_reverse_iterator
121 [[deprecated(
"Use the overload taking a Bond::Price argument instead")]]
164 [[deprecated(
"Use the overload taking a Bond::Price argument instead")]]
171 Real accuracy = 1.0e-10,
172 Size maxIterations = 100,
181 Real accuracy = 1.0e-10,
182 Size maxIterations = 100,
187 template <
typename Solver>
188 [[deprecated(
"Use the overload taking a Bond::Price argument instead")]]
196 Real accuracy = 1.0e-10,
199 return yield(solver, bond, {price, priceType}, dayCounter, compounding, frequency,
200 settlementDate, accuracy, guess);
202 template <
typename Solver>
210 Real accuracy = 1.0e-10,
212 if (settlementDate ==
Date())
216 "non tradable at " << settlementDate <<
224 amount /= 100.0 / bond.
notional(settlementDate);
226 return CashFlows::yield<Solver>(solver, bond.
cashflows(), amount, dayCounter,
228 frequency,
false, settlementDate,
229 settlementDate, accuracy, guess);
274 const ext::shared_ptr<YieldTermStructure>& discount,
281 const ext::shared_ptr<YieldTermStructure>& discount,
290 [[deprecated(
"Use the overload taking a Bond::Price argument instead")]]
293 const ext::shared_ptr<YieldTermStructure>&,
298 Real accuracy = 1.0e-10,
299 Size maxIterations = 100,
303 const ext::shared_ptr<YieldTermStructure>&,
308 Real accuracy = 1.0e-10,
309 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 Rate yield(const Bond &bond, Real price, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.05, Bond::Price::Type priceType=Bond::Price::Clean)
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 Rate yield(const Solver &solver, const Bond &bond, Real price, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, Date settlementDate=Date(), Real accuracy=1.0e-10, Rate guess=0.05, Bond::Price::Type priceType=Bond::Price::Clean)
static Spread zSpread(const Bond &bond, Real cleanPrice, 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 Leg::const_reverse_iterator previousCashFlow(const Bond &bond, Date refDate=Date())
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 Rate atmRate(const Bond &bond, const YieldTermStructure &discountCurve, Date settlementDate, Real cleanPrice)
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 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 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())