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
StochasticProcess Class Referenceabstract

multi-dimensional stochastic process class. More...

#include <stochasticprocess.hpp>

+ Inheritance diagram for StochasticProcess:
+ Collaboration diagram for StochasticProcess:

Classes

class  discretization
 discretization of a stochastic process over a given time interval More...
 

Public Member Functions

 ~StochasticProcess () override=default
 
Stochastic process interface
virtual Size size () const =0
 returns the number of dimensions of the stochastic process More...
 
virtual Size factors () const
 returns the number of independent factors of the process More...
 
virtual Array initialValues () const =0
 returns the initial values of the state variables More...
 
virtual Array drift (Time t, const Array &x) const =0
 returns the drift part of the equation, i.e., \( \mu(t, \mathrm{x}_t) \) More...
 
virtual Matrix diffusion (Time t, const Array &x) const =0
 returns the diffusion part of the equation, i.e. \( \sigma(t, \mathrm{x}_t) \) More...
 
virtual Array expectation (Time t0, const Array &x0, Time dt) const
 
virtual Matrix stdDeviation (Time t0, const Array &x0, Time dt) const
 
virtual Matrix covariance (Time t0, const Array &x0, Time dt) const
 
virtual Array evolve (Time t0, const Array &x0, Time dt, const Array &dw) const
 
virtual Array apply (const Array &x0, const Array &dx) const
 
utilities
virtual Time time (const Date &) const
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 

Observer interface

ext::shared_ptr< discretizationdiscretization_
 
void update () override
 
 StochasticProcess ()=default
 
 StochasticProcess (ext::shared_ptr< discretization >)
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Detailed Description

multi-dimensional stochastic process class.

This class describes a stochastic process governed by

\[ d\mathrm{x}_t = \mu(t, x_t)\mathrm{d}t + \sigma(t, \mathrm{x}_t) \cdot d\mathrm{W}_t. \]

Definition at line 42 of file stochasticprocess.hpp.

Constructor & Destructor Documentation

◆ ~StochasticProcess()

~StochasticProcess ( )
overridedefault

◆ StochasticProcess() [1/2]

StochasticProcess ( )
protecteddefault

◆ StochasticProcess() [2/2]

StochasticProcess ( ext::shared_ptr< discretization disc)
explicitprotected

Definition at line 29 of file stochasticprocess.cpp.

Member Function Documentation

◆ size()

virtual Size size ( ) const
pure virtual

◆ factors()

Size factors ( ) const
virtual

returns the number of independent factors of the process

Reimplemented in ExtOUWithJumpsProcess, KlugeExtOUProcess, LiborForwardModelProcess, BatesProcess, HestonProcess, HestonSLVProcess, and JointStochasticProcess.

Definition at line 32 of file stochasticprocess.cpp.

+ Here is the call graph for this function:

◆ initialValues()

virtual Array initialValues ( ) const
pure virtual

◆ drift()

virtual Array drift ( Time  t,
const Array x 
) const
pure virtual

returns the drift part of the equation, i.e., \( \mu(t, \mathrm{x}_t) \)

Implemented in ExtOUWithJumpsProcess, KlugeExtOUProcess, LiborForwardModelProcess, BatesProcess, G2Process, G2ForwardProcess, GJRGARCHProcess, HestonProcess, HestonSLVProcess, HybridHestonHullWhiteProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

+ Here is the caller graph for this function:

◆ diffusion()

virtual Matrix diffusion ( Time  t,
const Array x 
) const
pure virtual

returns the diffusion part of the equation, i.e. \( \sigma(t, \mathrm{x}_t) \)

Implemented in ExtOUWithJumpsProcess, KlugeExtOUProcess, LiborForwardModelProcess, G2Process, G2ForwardProcess, GJRGARCHProcess, HestonProcess, HestonSLVProcess, HybridHestonHullWhiteProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

+ Here is the caller graph for this function:

◆ expectation()

Array expectation ( Time  t0,
const Array x0,
Time  dt 
) const
virtual

returns the expectation \( E(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented in G2Process, G2ForwardProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

Definition at line 36 of file stochasticprocess.cpp.

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

◆ stdDeviation()

Matrix stdDeviation ( Time  t0,
const Array x0,
Time  dt 
) const
virtual

returns the standard deviation \( S(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented in G2Process, G2ForwardProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

Definition at line 42 of file stochasticprocess.cpp.

+ Here is the caller graph for this function:

◆ covariance()

Matrix covariance ( Time  t0,
const Array x0,
Time  dt 
) const
virtual

returns the covariance \( V(\mathrm{x}_{t_0 + \Delta t} | \mathrm{x}_{t_0} = \mathrm{x}_0) \) of the process after a time interval \( \Delta t \) according to the given discretization. This method can be overridden in derived classes which want to hard-code a particular discretization.

Reimplemented in LiborForwardModelProcess, G2Process, G2ForwardProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

Definition at line 48 of file stochasticprocess.cpp.

◆ evolve()

Array evolve ( Time  t0,
const Array x0,
Time  dt,
const Array dw 
) const
virtual

returns the asset value after a time interval \( \Delta t \) according to the given discretization. By default, it returns

\[ E(\mathrm{x}_0,t_0,\Delta t) + S(\mathrm{x}_0,t_0,\Delta t) \cdot \Delta \mathrm{w} \]

where \( E \) is the expectation and \( S \) the standard deviation.

Reimplemented in GemanRoncoroniProcess, ExtOUWithJumpsProcess, KlugeExtOUProcess, LiborForwardModelProcess, BatesProcess, GJRGARCHProcess, HestonProcess, HestonSLVProcess, HybridHestonHullWhiteProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

Definition at line 54 of file stochasticprocess.cpp.

+ Here is the call graph for this function:

◆ apply()

Array apply ( const Array x0,
const Array dx 
) const
virtual

applies a change to the asset value. By default, it returns \( \mathrm{x} + \Delta \mathrm{x} \).

Reimplemented in LiborForwardModelProcess, GJRGARCHProcess, HestonProcess, HestonSLVProcess, HybridHestonHullWhiteProcess, JointStochasticProcess, StochasticProcessArray, and StochasticProcess1D.

Definition at line 59 of file stochasticprocess.cpp.

+ Here is the caller graph for this function:

◆ time()

Time time ( const Date ) const
virtual

returns the time value corresponding to the given date in the reference system of the stochastic process.

Note
As a number of processes might not need this functionality, a default implementation is given which raises an exception.

Reimplemented in GeneralizedBlackScholesProcess, GJRGARCHProcess, HestonProcess, Merton76Process, StochasticProcessArray, GsrProcess, HestonSLVProcess, HybridHestonHullWhiteProcess, and JointStochasticProcess.

Definition at line 64 of file stochasticprocess.cpp.

+ Here is the caller graph for this function:

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Implements Observer.

Definition at line 68 of file stochasticprocess.cpp.

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

Member Data Documentation

◆ discretization_

ext::shared_ptr<discretization> discretization_
protected

Definition at line 153 of file stochasticprocess.hpp.