21#include <ql/cashflows/averagebmacoupon.hpp>
22#include <ql/cashflows/couponpricer.hpp>
23#include <ql/cashflows/floatingratecoupon.hpp>
24#include <ql/cashflows/indexedcashflow.hpp>
25#include <ql/cashflows/inflationcoupon.hpp>
32 if (t.
amount != Null<Real>())
38 out <<
" @ " << QuantLib::io::iso_date(t.
payDate);
43 const std::string& type,
const Size legNo,
const Currency& currency,
44 const Handle<YieldTermStructure>& discountCurve) {
49 cfResults.
type = type;
52 if (!discountCurve.empty()) {
60 const QuantLib::Real multiplier,
const QuantLib::Size legNo,
61 const QuantLib::Currency& currency) {
63 Date today = Settings::instance().evaluationDate();
67 cfResults.
amount = c->amount() * multiplier;
70 if (!currency.empty())
71 cfResults.
currency = currency.code();
75 if (
auto cpn = QuantLib::ext::dynamic_pointer_cast<Coupon>(c)) {
76 cfResults.
rate = cpn->rate();
82 cfResults.
type =
"Interest";
83 if (
auto ptrFloat = QuantLib::ext::dynamic_pointer_cast<QuantLib::FloatingRateCoupon>(cpn)) {
87 cfResults.
type =
"InterestProjected";
88 }
else if (
auto ptrInfl = QuantLib::ext::dynamic_pointer_cast<QuantLib::InflationCoupon>(cpn)) {
92 cfResults.
type =
"Inflation";
93 }
else if (
auto ptrBMA = QuantLib::ext::dynamic_pointer_cast<QuantLib::AverageBMACoupon>(cpn)) {
95 cfResults.
fixingDate = ptrBMA->fixingDates().end()[-2];
96 cfResults.
fixingValue = ptrBMA->pricer()->swapletRate();
98 cfResults.
type =
"BMAaverage";
101 cfResults.
type =
"Notional";
102 if (
auto ptrIndCf = QuantLib::ext::dynamic_pointer_cast<QuantLib::IndexedCashFlow>(c)) {
103 cfResults.
fixingDate = ptrIndCf->fixingDate();
105 cfResults.
type =
"Index";
106 }
else if (
auto ptrFxlCf = QuantLib::ext::dynamic_pointer_cast<QuantExt::FXLinkedCashFlow>(c)) {
108 cfResults.
fixingDate = ptrFxlCf->fxFixingDate();
class holding cashflow-related results
CashFlowResults standardCashFlowResults(const QuantLib::ext::shared_ptr< CashFlow > &c, const Real multiplier, const std::string &type, const Size legNo, const Currency ¤cy, const Handle< YieldTermStructure > &discountCurve)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
CashFlowResults populateCashFlowResultsFromCashflow(const QuantLib::ext::shared_ptr< QuantLib::CashFlow > &c, const QuantLib::Real multiplier, const QuantLib::Size legNo, const QuantLib::Currency ¤cy)
QuantLib::Real presentValue
QuantLib::Real accruedAmount
QuantLib::Real accrualPeriod
QuantLib::Date accrualStartDate
QuantLib::Real fixingValue
QuantLib::Date fixingDate
QuantLib::Date accrualEndDate
QuantLib::Real discountFactor