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

Discretized asset class used by numerical methods. More...

#include <discretizedasset.hpp>

+ Inheritance diagram for DiscretizedAsset:
+ Collaboration diagram for DiscretizedAsset:

Public Member Functions

 DiscretizedAsset ()
 
virtual ~DiscretizedAsset ()=default
 
inspectors
Time time () const
 
Timetime ()
 
const Arrayvalues () const
 
Arrayvalues ()
 
const ext::shared_ptr< Lattice > & method () const
 
High-level interface

Users of discretized assets should use these methods in order to initialize, evolve and take the present value of the assets. They call the corresponding methods in the Lattice interface, to which we refer for documentation.

void initialize (const ext::shared_ptr< Lattice > &, Time t)
 
void rollback (Time to)
 
void partialRollback (Time to)
 
Real presentValue ()
 

Low-level interface

These methods (that developers should override when deriving from DiscretizedAsset) are to be used by numerical methods and not directly by users, with the exception of adjustValues(), preAdjustValues() and postAdjustValues() that can be used together with partialRollback().

enum class  CouponAdjustment { pre , post }
 
Time time_
 
Time latestPreAdjustment_
 
Time latestPostAdjustment_
 
Array values_
 
ext::shared_ptr< Latticemethod_
 
virtual void reset (Size size)=0
 
void preAdjustValues ()
 
void postAdjustValues ()
 
void adjustValues ()
 
virtual std::vector< TimemandatoryTimes () const =0
 
bool isOnTime (Time t) const
 
virtual void preAdjustValuesImpl ()
 
virtual void postAdjustValuesImpl ()
 

Detailed Description

Discretized asset class used by numerical methods.

Definition at line 36 of file discretizedasset.hpp.

Member Enumeration Documentation

◆ CouponAdjustment

enum class CouponAdjustment
strongprotected

Indicates if a coupon should be adjusted in preAdjustValues() or postAdjustValues().

Enumerator
pre 
post 

Definition at line 128 of file discretizedasset.hpp.

Constructor & Destructor Documentation

◆ DiscretizedAsset()

Definition at line 38 of file discretizedasset.hpp.

◆ ~DiscretizedAsset()

virtual ~DiscretizedAsset ( )
virtualdefault

Member Function Documentation

◆ time() [1/2]

Time time ( ) const

Definition at line 45 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ time() [2/2]

Time & time ( )

Definition at line 46 of file discretizedasset.hpp.

◆ values() [1/2]

const Array & values ( ) const

Definition at line 48 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ values() [2/2]

Array & values ( )

Definition at line 49 of file discretizedasset.hpp.

◆ method()

const ext::shared_ptr< Lattice > & method ( ) const

Definition at line 51 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ initialize()

void initialize ( const ext::shared_ptr< Lattice > &  method,
Time  t 
)

Definition at line 182 of file discretizedasset.hpp.

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

◆ rollback()

void rollback ( Time  to)

Definition at line 189 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ partialRollback()

void partialRollback ( Time  to)

Definition at line 193 of file discretizedasset.hpp.

◆ presentValue()

Real presentValue ( )

Definition at line 197 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ reset()

virtual void reset ( Size  size)
pure virtual

This method should initialize the asset values to an Array of the given size and with values depending on the particular asset.

Implemented in DiscretizedDiscountBond, DiscretizedOption, DiscretizedDoubleBarrierOption, DiscretizedDermanKaniDoubleBarrierOption, DiscretizedCallableFixedRateBond, DiscretizedBarrierOption, DiscretizedDermanKaniBarrierOption, DiscretizedConvertible, DiscretizedCapFloor, DiscretizedSwap, DiscretizedSwaption, and DiscretizedVanillaOption.

+ Here is the caller graph for this function:

◆ preAdjustValues()

void preAdjustValues ( )

This method will be invoked after rollback and before any other asset (i.e., an option on this one) has any chance to look at the values. For instance, payments happening at times already spanned by the rollback will be added here.

This method is not virtual; derived classes must override the protected preAdjustValuesImpl() method instead.

Definition at line 201 of file discretizedasset.hpp.

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

◆ postAdjustValues()

void postAdjustValues ( )

This method will be invoked after rollback and after any other asset had their chance to look at the values. For instance, payments happening at the present time (and therefore not included in an option to be exercised at this time) will be added here.

This method is not virtual; derived classes must override the protected postAdjustValuesImpl() method instead.

Definition at line 208 of file discretizedasset.hpp.

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

◆ adjustValues()

void adjustValues ( )

This method performs both pre- and post-adjustment

Definition at line 113 of file discretizedasset.hpp.

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

◆ mandatoryTimes()

virtual std::vector< Time > mandatoryTimes ( ) const
pure virtual

This method returns the times at which the numerical method should stop while rolling back the asset. Typical examples include payment times, exercise times and such.

Note
The returned values are not guaranteed to be sorted.

Implemented in DiscretizedDiscountBond, DiscretizedOption, DiscretizedDoubleBarrierOption, DiscretizedDermanKaniDoubleBarrierOption, DiscretizedCallableFixedRateBond, DiscretizedBarrierOption, DiscretizedDermanKaniBarrierOption, DiscretizedConvertible, DiscretizedCapFloor, DiscretizedSwap, and DiscretizedVanillaOption.

◆ isOnTime()

bool isOnTime ( Time  t) const
protected

This method checks whether the asset was rolled at the given time.

Definition at line 215 of file discretizedasset.hpp.

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

◆ preAdjustValuesImpl()

virtual void preAdjustValuesImpl ( )
protectedvirtual

This method performs the actual pre-adjustment

Reimplemented in DiscretizedCallableFixedRateBond, DiscretizedCapFloor, and DiscretizedSwap.

Definition at line 134 of file discretizedasset.hpp.

+ Here is the caller graph for this function:

◆ postAdjustValuesImpl()

virtual void postAdjustValuesImpl ( )
protectedvirtual

Member Data Documentation

◆ time_

Time time_
protected

Definition at line 138 of file discretizedasset.hpp.

◆ latestPreAdjustment_

Time latestPreAdjustment_
protected

Definition at line 139 of file discretizedasset.hpp.

◆ latestPostAdjustment_

Time latestPostAdjustment_
protected

Definition at line 139 of file discretizedasset.hpp.

◆ values_

Array values_
protected

Definition at line 140 of file discretizedasset.hpp.

◆ method_

ext::shared_ptr<Lattice> method_
private

Definition at line 142 of file discretizedasset.hpp.