27#ifndef quantlib_cashflows_hpp
28#define quantlib_cashflows_hpp
37 class YieldTermStructure;
50 bool includeSettlementDateFlows,
80 bool includeSettlementDateFlows,
87 static Leg::const_reverse_iterator
89 bool includeSettlementDateFlows,
92 static Leg::const_iterator
94 bool includeSettlementDateFlows,
98 bool includeSettlementDateFlows,
102 bool includeSettlementDateFlows,
106 bool includeSettlementDateFlows,
110 bool includeSettlementDateFlows,
118 bool includeSettlementDateFlows,
122 bool includeSettlementDateFlows,
127 bool includeSettlementDateFlows,
131 bool includeSettlementDateFlows,
135 bool includeSettlementDateFlows,
139 bool includeSettlementDateFlows,
143 bool includeSettlementDateFlows,
147 bool includeSettlementDateFlows,
151 bool includeSettlementDateFlows,
155 bool includeSettlementDateFlows,
159 bool includeSettlementDateFlows,
163 bool includeSettlementDateFlows,
175 bool includeSettlementDateFlows,
186 bool includeSettlementDateFlows,
194 static std::pair<Real, Real>
npvbps(
const Leg& leg,
196 bool includeSettlementDateFlows,
208 bool includeSettlementDateFlows,
227 bool includeSettlementDateFlows,
235 bool includeSettlementDateFlows,
248 bool includeSettlementDateFlows,
256 bool includeSettlementDateFlows,
269 bool includeSettlementDateFlows,
272 Real accuracy = 1.0e-10,
273 Size maxIterations = 100,
276 template <
typename Solver>
283 bool includeSettlementDateFlows,
286 Real accuracy = 1.0e-10,
288 IrrFinder objFunction(leg,
npv, dayCounter, compounding,
289 frequency, includeSettlementDateFlows,
290 settlementDate, npvDate);
291 return solver.solve(objFunction, accuracy, guess, guess/10.0);
321 bool includeSettlementDateFlows,
330 bool includeSettlementDateFlows,
344 bool includeSettlementDateFlows,
352 bool includeSettlementDateFlows,
362 bool includeSettlementDateFlows,
370 bool includeSettlementDateFlows,
381 bool includeSettlementDateFlows,
389 bool includeSettlementDateFlows,
407 const ext::shared_ptr<YieldTermStructure>& discount,
412 bool includeSettlementDateFlows,
418 const ext::shared_ptr<YieldTermStructure>&,
422 bool includeSettlementDateFlows,
425 Real accuracy = 1.0e-10,
426 Size maxIterations = 100,
430 const ext::shared_ptr<YieldTermStructure>&
d,
435 bool includeSettlementDateFlows,
438 Real accuracy = 1.0e-10,
439 Size maxIterations = 100,
441 return zSpread(leg,
npv,
d, dayCounter, compounding, frequency,
442 includeSettlementDateFlows, settlementDate, npvDate,
443 accuracy, maxIterations, guess);
Base class for cash flows.
Real derivative(Rate y) const
Real operator()(Rate y) const
bool includeSettlementDateFlows_
cashflow-analysis functions
static Date::serial_type accruedDays(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Real previousCashFlowAmount(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Rate previousCouponRate(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
CashFlows(const CashFlows &)=delete
static Rate nextCouponRate(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Date referencePeriodStart(const Leg &leg, bool includeSettlementDateFlows, Date settlDate=Date())
static Real nextCashFlowAmount(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Real yieldValueBasisPoint(const Leg &leg, const InterestRate &yield, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Yield value of a basis point.
static Real accruedAmount(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Real basisPointValue(const Leg &leg, const InterestRate &yield, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Basis-point value.
static Leg::const_iterator nextCashFlow(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
the first cashflow paying after the given date
static Spread zSpread(const Leg &leg, Real npv, const ext::shared_ptr< YieldTermStructure > &, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.0)
implied Z-spread.
static Real npv(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
NPV of the cash flows.
static Date accrualEndDate(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Date accrualStartDate(const Leg &leg, bool includeSettlementDateFlows, Date settlDate=Date())
static Leg::const_reverse_iterator previousCashFlow(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
the last cashflow paying before or at the given date
static Date nextCashFlowDate(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Rate yield(const Leg &leg, Real npv, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.05)
Implied internal rate of return.
static Time accrualPeriod(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Date::serial_type accrualDays(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Date maturityDate(const Leg &leg)
static Time duration(const Leg &leg, const InterestRate &yield, Duration::Type type, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Cash-flow duration.
CashFlows & operator=(CashFlows &&)=delete
static Date startDate(const Leg &leg)
static Real nominal(const Leg &leg, bool includeSettlementDateFlows, Date settlDate=Date())
CashFlows & operator=(const CashFlows &)=delete
static Date previousCashFlowDate(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Rate yield(const Solver &solver, const Leg &leg, Real npv, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real accuracy=1.0e-10, Rate guess=0.05)
static Rate atmRate(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real npv=Null< Real >())
At-the-money rate of the cash flows.
static bool isExpired(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Real bps(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Basis-point sensitivity of the cash flows.
static Spread zSpread(const Leg &leg, const ext::shared_ptr< YieldTermStructure > &d, Real npv, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.0)
deprecated implied Z-spread.
CashFlows(CashFlows &&)=delete
static std::pair< Real, Real > npvbps(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
NPV and BPS of the cash flows.
static Date referencePeriodEnd(const Leg &leg, bool includeSettlementDateFlows, Date settlDate=Date())
static Time accruedPeriod(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
static Real convexity(const Leg &leg, const InterestRate &yield, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Cash-flow convexity.
std::int_fast32_t serial_type
serial number type
Concrete interest rate class.
template class providing a null value for a given type.
Interest-rate term structure.
Duration type enumeration.
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.
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Maps shared_ptr to either the boost or std implementation.