QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
MarketModelComposite Class Reference

Composition of two or more market-model products. More...

#include <compositeproduct.hpp>

+ Inheritance diagram for MarketModelComposite:
+ Collaboration diagram for MarketModelComposite:

Classes

struct  SubProduct
 

Public Member Functions

 MarketModelComposite ()=default
 
MarketModelMultiProduct interface
const EvolutionDescriptionevolution () const override
 
std::vector< SizesuggestedNumeraires () const override
 
std::vector< TimepossibleCashFlowTimes () const override
 
void reset () override
 during simulation put product at start of path More...
 
- Public Member Functions inherited from MarketModelMultiProduct
virtual ~MarketModelMultiProduct ()=default
 
virtual std::vector< SizesuggestedNumeraires () const =0
 
virtual const EvolutionDescriptionevolution () const =0
 
virtual std::vector< TimepossibleCashFlowTimes () const =0
 
virtual Size numberOfProducts () const =0
 
virtual Size maxNumberOfCashFlowsPerProductPerStep () const =0
 
virtual void reset ()=0
 during simulation put product at start of path More...
 
virtual bool nextTimeStep (const CurveState &currentState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< CashFlow > > &cashFlowsGenerated)=0
 return value indicates whether path is finished, TRUE means done More...
 
virtual std::unique_ptr< MarketModelMultiProductclone () const =0
 returns a newly-allocated copy of itself More...
 

Composite facilities

typedef std::vector< SubProduct >::iterator iterator
 
typedef std::vector< SubProduct >::const_iterator const_iterator
 
std::vector< SubProductcomponents_
 
std::vector< TimerateTimes_
 
std::vector< TimeevolutionTimes_
 
EvolutionDescription evolution_
 
bool finalized_ = false
 
Size currentIndex_
 
std::vector< TimecashflowTimes_
 
std::vector< std::vector< Time > > allEvolutionTimes_
 
std::vector< std::valarray< bool > > isInSubset_
 
void add (const Clone< MarketModelMultiProduct > &, Real multiplier=1.0)
 
void subtract (const Clone< MarketModelMultiProduct > &, Real multiplier=1.0)
 
void finalize ()
 
Size size () const
 
const MarketModelMultiProductitem (Size i) const
 
MarketModelMultiProductitem (Size i)
 
Real multiplier (Size i) const
 

Detailed Description

Composition of two or more market-model products.

Instances of this class build a market-model product by composing one or more subproducts.

Precondition
All subproducts must have the same rate times.

Definition at line 36 of file compositeproduct.hpp.

Member Typedef Documentation

◆ iterator

typedef std::vector<SubProduct>::iterator iterator
protected

Definition at line 69 of file compositeproduct.hpp.

◆ const_iterator

typedef std::vector<SubProduct>::const_iterator const_iterator
protected

Definition at line 70 of file compositeproduct.hpp.

Constructor & Destructor Documentation

◆ MarketModelComposite()

MarketModelComposite ( )
default

Member Function Documentation

◆ evolution()

const EvolutionDescription & evolution ( ) const
overridevirtual

Implements MarketModelMultiProduct.

Definition at line 25 of file compositeproduct.cpp.

+ Here is the caller graph for this function:

◆ suggestedNumeraires()

std::vector< Size > suggestedNumeraires ( ) const
overridevirtual

Implements MarketModelMultiProduct.

Definition at line 30 of file compositeproduct.cpp.

+ Here is the call graph for this function:

◆ possibleCashFlowTimes()

std::vector< Time > possibleCashFlowTimes ( ) const
overridevirtual

Implements MarketModelMultiProduct.

Definition at line 35 of file compositeproduct.cpp.

+ Here is the caller graph for this function:

◆ reset()

void reset ( )
overridevirtual

during simulation put product at start of path

Implements MarketModelMultiProduct.

Definition at line 40 of file compositeproduct.cpp.

+ Here is the caller graph for this function:

◆ add()

void add ( const Clone< MarketModelMultiProduct > &  product,
Real  multiplier = 1.0 
)
Examples
MarketModels.cpp.

Definition at line 50 of file compositeproduct.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subtract()

void subtract ( const Clone< MarketModelMultiProduct > &  product,
Real  multiplier = 1.0 
)

Definition at line 73 of file compositeproduct.cpp.

+ Here is the call graph for this function:

◆ finalize()

void finalize ( )
Examples
MarketModels.cpp.

Definition at line 79 of file compositeproduct.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

Size size ( ) const

Definition at line 139 of file compositeproduct.cpp.

◆ item() [1/2]

const MarketModelMultiProduct & item ( Size  i) const

Definition at line 143 of file compositeproduct.cpp.

+ Here is the caller graph for this function:

◆ item() [2/2]

Definition at line 147 of file compositeproduct.cpp.

◆ multiplier()

Real multiplier ( Size  i) const

Definition at line 151 of file compositeproduct.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ components_

std::vector<SubProduct> components_
protected

Definition at line 68 of file compositeproduct.hpp.

◆ rateTimes_

std::vector<Time> rateTimes_
protected

Definition at line 72 of file compositeproduct.hpp.

◆ evolutionTimes_

std::vector<Time> evolutionTimes_
protected

Definition at line 73 of file compositeproduct.hpp.

◆ evolution_

EvolutionDescription evolution_
protected

Definition at line 74 of file compositeproduct.hpp.

◆ finalized_

bool finalized_ = false
protected

Definition at line 76 of file compositeproduct.hpp.

◆ currentIndex_

Size currentIndex_
protected

Definition at line 77 of file compositeproduct.hpp.

◆ cashflowTimes_

std::vector<Time> cashflowTimes_
protected

Definition at line 78 of file compositeproduct.hpp.

◆ allEvolutionTimes_

std::vector<std::vector<Time> > allEvolutionTimes_
protected

Definition at line 79 of file compositeproduct.hpp.

◆ isInSubset_

std::vector<std::valarray<bool> > isInSubset_
protected

Definition at line 80 of file compositeproduct.hpp.