CompositeInstrument Class Reference
[Financial instruments]
#include <ql/Instruments/compositeinstrument.hpp>
Inheritance diagram for CompositeInstrument:

Detailed Description
Composite instrument.This instrument is an aggregate of other instruments. Its NPV is the sum of the NPVs of its components, each possibly multiplied by a given factor.
Example: static replication of a down-and-out barrier option
- Warning:
- Methods that drive the calculation directly (such as recalculate(), freeze() and others) might not work correctly.
- Examples:
Instrument interface | |
| bool | isExpired () const |
| returns whether the instrument is still tradable. | |
| void | performCalculations () const |
Public Member Functions | |
| void | add (const boost::shared_ptr< Instrument > &instrument, Real multiplier=1.0) |
| adds an instrument to the composite | |
| void | subtract (const boost::shared_ptr< Instrument > &instrument, Real multiplier=1.0) |
| shorts an instrument from the composite | |
Member Function Documentation
| void performCalculations | ( | ) | const [protected, virtual] |
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.
Reimplemented from Instrument.