36 if (cashFlows.empty())
37 return out <<
"no cashflows" << std::endl;
38 out <<
"cashflows" << std::endl;
39 std::string currencyCode;
40 Real totalDiscounted = 0;
41 Real totalUndiscounted = 0;
42 for (
const auto& i : cashFlows) {
44 const ext::shared_ptr<CommodityCashFlow> cashFlow = i.second;
45 totalDiscounted += cashFlow->discountedAmount().value();
46 totalUndiscounted += cashFlow->undiscountedAmount().value();
48 out <<
io::iso_date(i.first) <<
" " << std::setw(16) << std::right << std::fixed
49 << std::setprecision(2) << cashFlow->discountedAmount().value() <<
" "
50 << currencyCode << std::setw(16) << std::right << std::fixed << std::setprecision(2)
51 << cashFlow->undiscountedAmount().value() <<
" " << currencyCode << std::endl;
54 << std::setw(16) << std::right << std::fixed
55 << std::setprecision(2) << totalDiscounted <<
" " << currencyCode
56 << std::setw(16) << std::right << std::fixed
57 << std::setprecision(2) << totalUndiscounted <<
" "
58 << currencyCode << std::endl;
degenerate base class for the Acyclic Visitor pattern
void accept(AcyclicVisitor &) override
Visitor for a specific class
virtual void visit(T &)=0
detail::iso_date_holder iso_date(const Date &d)
output dates in ISO format (yyyy-mm-dd)
std::map< Date, ext::shared_ptr< CommodityCashFlow > > CommodityCashFlows
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
ext::shared_ptr< BlackVolTermStructure > v
degenerate base class for the Acyclic Visitor pattern