Logo
Reference manual - version ored_version
InstrumentWrapper Class Referenceabstract

Instrument Wrapper. More...

#include <ored/portfolio/instrumentwrapper.hpp>

Inheritance diagram for InstrumentWrapper:

Public Member Functions

 InstrumentWrapper (const QuantLib::ext::shared_ptr< QuantLib::Instrument > &inst, const Real multiplier=1.0, const std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > > &additionalInstruments=std::vector< QuantLib::ext::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.
virtual QuantLib::Real NPV () const =0
 Return the NPV of this instrument.
virtual const std::map< std::string, QuantLib::ext::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?
QuantLib::ext::shared_ptr< QuantLib::Instrument > qlInstrument (const bool calculate=false) const
 Inspectors.
Real multiplier () const
virtual Real multiplier2 () const
const std::vector< QuantLib::ext::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 QuantLib::ext::shared_ptr< QuantLib::Instrument > &instr) const

Protected Attributes

QuantLib::ext::shared_ptr< QuantLib::Instrument > instrument_
Real multiplier_
std::vector< QuantLib::ext::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

  • store instrument "state" for each scenario
  • adjust the instrument pricing formula to account for state

Member Function Documentation

◆ initialise()

virtual void initialise ( const std::vector< QuantLib::Date > & dates)
pure virtual

Initialise with the given date grid.

Implemented in BondPositionInstrumentWrapper, CompositeInstrumentWrapper, OptionWrapper, and VanillaInstrument.

◆ 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 BondPositionInstrumentWrapper, CompositeInstrumentWrapper, OptionWrapper, and VanillaInstrument.

◆ NPV()

virtual QuantLib::Real NPV ( ) const
pure virtual

◆ additionalResults()

virtual const std::map< std::string, QuantLib::ext::any > & additionalResults ( ) const
pure virtual

Return the additional results of this instrument.

Implemented in BarrierOptionWrapper, BondPositionInstrumentWrapper, CompositeInstrumentWrapper, OptionWrapper, and VanillaInstrument.

◆ updateQlInstruments()

virtual void updateQlInstruments ( )
virtual

call update on enclosed instrument(s)

Reimplemented in BondPositionInstrumentWrapper, CompositeInstrumentWrapper, and OptionWrapper.

◆ isOption()

virtual bool isOption ( )
virtual

is it an Option?

Reimplemented in CompositeInstrumentWrapper, and OptionWrapper.

◆ qlInstrument()

QuantLib::ext::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< QuantLib::ext::shared_ptr< QuantLib::Instrument > > & additionalInstruments ( ) const

additional instruments

◆ additionalMultipliers()

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

multipliers for additional instruments