38 : settlementDays_(settlementDays), calendar_(
std::move(calendar)), cashflows_(coupons),
39 issueDate_(issueDate) {
41 if (!coupons.empty()) {
48 ") must be earlier than first payment date (" <<
65 const Date& maturityDate,
66 const Date& issueDate,
68 : settlementDays_(settlementDays), calendar_(
std::move(calendar)), cashflows_(cashflows),
69 maturityDate_(maturityDate), issueDate_(issueDate) {
82 ") must be earlier than first payment date (" <<
142 "multiple redemption cash flows given");
180 if (currentNotional == 0.0)
189 "settlement value not provided");
206 if (currentNotional == 0.0)
213 accuracy, maxEvaluations,
221 Date settlement)
const {
229 Date settlement)
const {
231 if (currentNotional == 0.0)
247 return yield({price, priceType}, dc, comp, freq, settlement, accuracy,
248 maxEvaluations, guess);
259 if (currentNotional == 0.0)
263 settlement, accuracy, maxEvaluations,
269 if (currentNotional == 0.0)
327 ext::shared_ptr<CashFlow> payment;
346 ext::shared_ptr<CashFlow> redemptionCashflow(
352 const ext::shared_ptr<CashFlow>& redemption) {
369 cashflow->deepUpdate();
381 ext::shared_ptr<Coupon> coupon = ext::dynamic_pointer_cast<Coupon>(cashflow);
389 lastPaymentDate = coupon->date();
397 lastPaymentDate = coupon->date();
401 lastPaymentDate = coupon->date();
Cash-flow analysis functions.
void validate() const override
Real cleanPrice() const
theoretical clean price
void setupArguments(PricingEngine::arguments *) const override
Rate previousCouponRate(Date d=Date()) const
Previous coupon already paid at a given date.
bool isExpired() const override
returns whether the instrument might have value greater than zero.
void addRedemptionsToCashflows(const std::vector< Real > &redemptions=std::vector< Real >())
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
virtual Real accruedAmount(Date d=Date()) const
accrued amount at a given date
void deepUpdate() override
const Leg & cashflows() const
Date nextCashFlowDate(Date d=Date()) const
Bond(Natural settlementDays, Calendar calendar, const Date &issueDate=Date(), const Leg &coupons=Leg())
constructor for amortizing or non-amortizing bonds.
Real settlementValue() const
theoretical settlement value
std::vector< Real > notionals_
Real dirtyPrice() const
theoretical dirty price
const ext::shared_ptr< CashFlow > & redemption() const
void setSingleRedemption(Real notional, Real redemption, const Date &date)
Date previousCashFlowDate(Date d=Date()) const
Date maturityDate() const
bool isTradable(Date d=Date()) const
const Leg & redemptions() const
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
std::vector< Date > notionalSchedule_
void calculateNotionalsFromCashflows()
virtual Real notional(Date d=Date()) const
Date settlementDate(Date d=Date()) const
virtual Rate nextCouponRate(Date d=Date()) const
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
static Date maturityDate(const Leg &leg)
static bool isExpired(const Leg &leg, bool includeSettlementDateFlows, Date settlementDate=Date())
void calculate() const override
virtual void fetchResults(const PricingEngine::results *) const
virtual void setupExpired() const
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_ENSURE(condition, message)
throw an error if the given post-condition is not verified
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Coupon paying a variable index-based rate.
Frequency
Frequency of events.
unsigned QL_INTEGER Natural
positive integer
std::size_t Size
size of a container
Compounding
Interest rate coumpounding rule.
bool close(const Quantity &m1, const Quantity &m2, Size n)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
ext::shared_ptr< YieldTermStructure > r
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 Rate nextCouponRate(const Bond &bond, Date settlementDate=Date())
static Date startDate(const Bond &bond)
static bool isTradable(const Bond &bond, Date settlementDate=Date())
static Date maturityDate(const Bond &bond)
static Date previousCashFlowDate(const Bond &bond, Date refDate=Date())
static Date nextCashFlowDate(const Bond &bond, Date refDate=Date())
static Real accruedAmount(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())
compare two objects by date