Logo
Reference manual - version ored_version
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
InstrumentWrapper Class Referenceabstract

Instrument Wrapper. More...

#include <ored/portfolio/instrumentwrapper.hpp>

+ Inheritance diagram for InstrumentWrapper:

Public Member Functions

 InstrumentWrapper (const boost::shared_ptr< QuantLib::Instrument > &inst, const Real multiplier=1.0, const std::vector< boost::shared_ptr< QuantLib::Instrument >> &additionalInstruments=std::vector< boost::shared_ptr< QuantLib::Instrument >>(), const std::vector< Real > &additionalMultipliers=std::vector< Real >())
 
virtual void initialise (const std::vector< QuantLib::Date > &dates)=0
 Initialise with the given date grid.
 
virtual void reset ()=0
 reset is called every time a new path is about to be priced. More...
 
virtual QuantLib::Real NPV () const =0
 Return the NPV of this instrument.
 
virtual const std::map< std::string, boost::any > & additionalResults () const =0
 Return the additional results of this instrument.
 
QuantLib::Real additionalInstrumentsNPV () const
 
virtual void updateQlInstruments ()
 call update on enclosed instrument(s)
 
virtual bool isOption ()
 is it an Option?
 
boost::shared_ptr< QuantLib::Instrument > qlInstrument (const bool calculate=false) const
 Inspectors. More...
 
Real multiplier () const
 
virtual Real multiplier2 () const
 
const std::vector< boost::shared_ptr< QuantLib::Instrument > > & additionalInstruments () const
 
const std::vector< Real > & additionalMultipliers () const
 
boost::timer::nanosecond_type getCumulativePricingTime () const
 Get cumulative timing spent on pricing.
 
std::size_t getNumberOfPricings () const
 Get number of pricings.
 
void resetPricingStats () const
 Reset pricing statistics.
 

Protected Member Functions

Real getTimedNPV (const boost::shared_ptr< QuantLib::Instrument > &instr) const
 

Protected Attributes

boost::shared_ptr< QuantLib::Instrument > instrument_
 
Real multiplier_
 
std::vector< boost::shared_ptr< QuantLib::Instrument > > additionalInstruments_
 
std::vector< Real > additionalMultipliers_
 
std::size_t numberOfPricings_ = 0
 
boost::timer::nanosecond_type cumulativePricingTime_ = 0
 

Detailed Description

Instrument Wrapper.

Wrap Instrument base class Derived classes should

Member Function Documentation

◆ reset()

virtual void reset ( )
pure virtual

reset is called every time a new path is about to be priced.

For path dependent Wrappers, this is when internal state should be reset

Implemented in OptionWrapper, VanillaInstrument, CompositeInstrumentWrapper, and BondPositionInstrumentWrapper.

◆ qlInstrument()

boost::shared_ptr<QuantLib::Instrument> qlInstrument ( const bool  calculate = false) const

Inspectors.

The "QuantLib" instrument Pass true if you trigger a calculation on the returned instrument and want to record the timing for that calculation. If in doubt whether a calculation is triggered, pass false.

◆ multiplier()

Real multiplier ( ) const

The multiplier

◆ multiplier2()

virtual Real multiplier2 ( ) const
virtual

multiplier to be applied on top of multiplier(), e.g. -1 for short options

Reimplemented in OptionWrapper.

◆ additionalInstruments()

const std::vector<boost::shared_ptr<QuantLib::Instrument> >& additionalInstruments ( ) const

additional instruments

◆ additionalMultipliers()

const std::vector<Real>& additionalMultipliers ( ) const

multipliers for additional instruments