QuantLib 0.3.7
Getting started
Reference manual
|
Instrument Class Reference#include <ql/instrument.hpp>
Inheritance diagram for Instrument:
[legend]List of all members.
Detailed Description
Abstract instrument class.
This class is purely abstract and defines the interface of concrete instruments which will be derived from this one.
|
Public Member Functions |
virtual void | setupArguments (Arguments *) const |
|
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.
|
|
void | setPricingEngine (const boost::shared_ptr< PricingEngine > &) |
| set the pricing engine to be used.
|
Protected Member Functions |
|
void | calculate () const |
virtual void | setupExpired () const |
virtual void | performCalculations () const |
Protected Attributes |
boost::shared_ptr< PricingEngine > | engine_ |
|
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
void setPricingEngine |
( |
const boost::shared_ptr< PricingEngine > & |
|
) |
|
|
|
set the pricing engine to be used.
- Warning:
- calling this method will have no effects in case the performCalculation method was overridden in a derived class.
|
void setupArguments |
( |
Arguments * |
|
) |
const [virtual] |
|
|
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, SimpleSwap, and Swaption. |
void calculate |
( |
|
) |
const [protected, virtual] |
|
|
This method performs all needed calculations by calling the performCalculations method.
- Warning:
- Objects cache the results of the previous calculation. Such results will be returned upon later invocations of calculate. When the results depend on arguments which could change between invocations, the lazy object must register itself as observer of such objects for the calculations to be performed again when they change.
Should this method be redefined in derived classes, LazyObject::calculate() should be called in the overriding method.
Reimplemented from LazyObject. |
void setupExpired |
( |
|
) |
const [protected, virtual] |
|
void performCalculations |
( |
|
) |
const [protected, virtual] |
|
|