Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cashflowtable.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2014 - 2016 Quaternion Risk Management Ltd.
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
20
21using namespace std;
22using namespace QuantLib;
23
24namespace QuantExt {
25
27 : startDate_(Null<Date>()), endDate_(Null<Date>()), startNotional_(Null<Real>()), endNotional_(Null<Real>()),
28 couponAmount_(Null<Real>()), allInRate_(Null<Rate>()), rate_(Null<Rate>()), spread_(Null<Spread>()),
29 discount_(Null<DiscountFactor>()) {}
30
31CashflowRow& CashflowRow::withStartDate(const Date& startDate) {
33 return *this;
34}
35
38 return *this;
39}
40
43 return *this;
44}
45
48 return *this;
49}
50
53 return *this;
54}
55
58 return *this;
59}
60
62 rate_ = rate;
63 return *this;
64}
65
68 return *this;
69}
70
71CashflowRow& CashflowRow::withDiscount(DiscountFactor discount) {
73 return *this;
74}
75
76void CashflowTable::add(const CashflowRow& cashflowRow) { rows_.push_back(cashflowRow); }
77
78Size CashflowTable::size() const { return rows_.size(); }
79
80const CashflowRow& CashflowTable::operator[](Size i) const {
81 // Throws out_of_range error if i is out of range
82 // TODO: is this enough e.g. QuantLib::Schedule for example
83 return rows_.at(i);
84}
85
86CashflowRow& CashflowTable::operator[](Size i) { return rows_[i]; }
87
88} // namespace QuantExt
Cashflow table to store cashflow calculation results.
Class representing the row of a cashflow table.
QuantLib::Real startNotional() const
CashflowRow & withStartDate(const QuantLib::Date &startDate)
const QuantLib::Date & endDate() const
QuantLib::Date endDate_
QuantLib::Real couponAmount_
QuantLib::Spread spread() const
const QuantLib::Date & startDate() const
QuantLib::Spread spread_
QuantLib::DiscountFactor discount() const
CashflowRow & withCouponAmount(QuantLib::Real couponAmount)
QuantLib::Real couponAmount() const
CashflowRow & withDiscount(QuantLib::DiscountFactor discount)
QuantLib::DiscountFactor discount_
CashflowRow & withAllInRate(QuantLib::Rate allInRate)
CashflowRow()
Default constructor sets all variables to Null value.
CashflowRow & withSpread(QuantLib::Spread spread)
CashflowRow & withEndDate(const QuantLib::Date &endDate)
CashflowRow & withEndNotional(QuantLib::Real endNotional)
QuantLib::Real endNotional() const
QuantLib::Real startNotional_
QuantLib::Real endNotional_
QuantLib::Rate allInRate_
CashflowRow & withStartNotional(QuantLib::Real startNotional)
CashflowRow & withRate(QuantLib::Rate rate)
QuantLib::Date startDate_
QuantLib::Rate rate() const
QuantLib::Rate allInRate() const
QuantLib::Rate rate_
std::vector< CashflowRow > rows_
void add(const CashflowRow &cashflowRow)
Add a row to the cashflow table.
QuantLib::Size size() const
Return the number of rows in the cashflow table.
const CashflowRow & operator[](QuantLib::Size i) const
Retrieve row i from the cashflow table.
SimpleQuote & spread_