25#ifndef quantlib_instrument_hpp
26#define quantlib_instrument_hpp
59 template <
typename T>
T result(
const std::string& tag)
const;
150 engine_->getArguments()->validate();
176 "error estimate not provided");
183 "valuation date not provided");
190 std::map<std::string, ext::any>::const_iterator value =
193 tag <<
" not provided");
194 return ext::any_cast<T>(value->second);
197 inline const std::map<std::string, ext::any>&
Maps any to either the boost or std implementation.
std::map< std::string, ext::any > additionalResults
Abstract instrument class.
const std::map< std::string, ext::any > & additionalResults() const
returns all additional result returned by the pricing engine.
void performCalculations() const override
std::map< std::string, ext::any > additionalResults_
T result(const std::string &tag) const
returns any additional result returned by the pricing engine.
Real NPV() const
returns the net present value of the instrument.
void calculate() const override
virtual bool isExpired() const =0
returns whether the instrument might have value greater than zero.
virtual void fetchResults(const PricingEngine::results *) const
Real errorEstimate() const
returns the error estimate on the NPV when available.
ext::shared_ptr< PricingEngine > engine_
const Date & valuationDate() const
returns the date the net present value refers to.
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
virtual void setupArguments(PricingEngine::arguments *) const
virtual void setupExpired() const
Framework for calculation on demand and result caching.
virtual void calculate() const
template class providing a null value for a given type.
date- and time-related classes, typedefs and enumerations
#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
framework for calculation on demand and result caching
ext::shared_ptr< YieldTermStructure > r
Base class for pricing engines.