Instrument Class Reference
#include <ql/instrument.hpp>
Inheritance diagram for Instrument:

Detailed Description
Abstract instrument class.This class is purely abstract and defines the interface of concrete instruments which will be derived from this one.
- Tests:
- observability of class instances is checked.
Public Member Functions | |
virtual void | setupArguments (Arguments *) const |
virtual void | fetchResults (const Results *) const |
Inspectors | |
Real | NPV () const |
returns the net present value of the instrument. | |
Real | errorEstimate () const |
returns the error estimate on the NPV when available. | |
virtual bool | isExpired () const =0 |
returns whether the instrument is still tradable. | |
Modifiers | |
void | setPricingEngine (const boost::shared_ptr< PricingEngine > &) |
set the pricing engine to be used. | |
Protected Member Functions | |
Calculations | |
void | calculate () const |
virtual void | setupExpired () const |
virtual void | performCalculations () const |
Protected Attributes | |
boost::shared_ptr< PricingEngine > | engine_ |
Results | |
The value of this attribute and any other that derived classes might declare must be set during calculation. | |
Real | NPV_ |
Real | errorEstimate_ |
Member Function Documentation
|
set the pricing engine to be used.
|
|
When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used. Reimplemented in ContinuousAveragingAsianOption, DiscreteAveragingAsianOption, BarrierOption, BasketOption, CapFloor, CliquetOption, DividendVanillaOption, ForwardVanillaOption, MultiAssetOption, OneAssetOption, OneAssetStrikedOption, QuantoForwardVanillaOption, QuantoVanillaOption, VanillaSwap, and Swaption. |
|
When a derived result structure is defined for an instrument, this method should be overridden to read from it. This is mandatory in case a pricing engine is used. Reimplemented in ForwardVanillaOption, MultiAssetOption, OneAssetOption, OneAssetStrikedOption, QuantoVanillaOption, and VanillaSwap. |
|
This method performs all needed calculations by calling the performCalculations method.
Reimplemented from LazyObject. |
|
This method must leave the instrument in a consistent state when the expiration condition is met. Reimplemented in MultiAssetOption, OneAssetOption, OneAssetStrikedOption, QuantoVanillaOption, and Swap. |
|
In case a pricing engine is not used, this method must be overridden to perform the actual calculations and set any needed results. In case a pricing engine is used, the default implementation can be used. Implements LazyObject. |