21#include <ql/cashflows/cashflows.hpp>
22#include <ql/pricingengines/swap/discountingswapengine.hpp>
23#include <ql/utilities/dataformatters.hpp>
24#include <ql/optional.hpp>
31 const ext::optional<bool>& includeSettlementDateFlows,
34 : discountCurve_(
std::move(discountCurve)),
35 includeSettlementDateFlows_(includeSettlementDateFlows), settlementDate_(settlementDate),
42 "discounting term structure handle is empty");
51 settlementDate = refDate;
53 QL_REQUIRE(settlementDate>=refDate,
54 "settlement date (" << settlementDate <<
") before "
55 "discount curve reference date (" << refDate <<
")");
63 "npv date (" <<
npvDate_ <<
") before "
64 "discount curve reference date (" << refDate <<
")");
78 for (
Size i=0; i<n; ++i) {
107 }
catch (std::exception &e) {
static Date maturityDate(const Leg &leg)
static Date startDate(const Leg &leg)
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.
Handle< YieldTermStructure > discountCurve_
DiscountingSwapEngine(Handle< YieldTermStructure > discountCurve=Handle< YieldTermStructure >(), const ext::optional< bool > &includeSettlementDateFlows=ext::nullopt, Date settlementDate=Date(), Date npvDate=Date())
ext::optional< bool > includeSettlementDateFlows_
void calculate() const override
Swap::arguments arguments_
Shared handle to an observable.
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
bool & includeReferenceDateEvents()
static Settings & instance()
access to the unique instance
std::vector< Real > payer
std::vector< Real > legBPS
DiscountFactor npvDateDiscount
std::vector< DiscountFactor > endDiscounts
std::vector< DiscountFactor > startDiscounts
std::vector< Real > legNPV
Interest-rate term structure.
detail::ordinal_holder ordinal(Size)
outputs naturals as 1st, 2nd, 3rd...
std::size_t Size
size of a container