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

1-dimensional stochastic process More...

#include <stochasticprocess.hpp>

+ Inheritance diagram for StochasticProcess1D:
+ Collaboration diagram for StochasticProcess1D:

Classes

class  discretization
 discretization of a 1-D stochastic process More...
 

1-D stochastic process interface

ext::shared_ptr< discretizationdiscretization_
 
virtual Real x0 () const =0
 returns the initial value of the state variable More...
 
virtual Real drift (Time t, Real x) const =0
 returns the drift part of the equation, i.e. \( \mu(t, x_t) \) More...
 
virtual Real diffusion (Time t, Real x) const =0
 returns the diffusion part of the equation, i.e. \( \sigma(t, x_t) \) More...
 
virtual Real expectation (Time t0, Real x0, Time dt) const
 
virtual Real stdDeviation (Time t0, Real x0, Time dt) const
 
virtual Real variance (Time t0, Real x0, Time dt) const
 
virtual Real evolve (Time t0, Real x0, Time dt, Real dw) const
 
virtual Real apply (Real x0, Real dx) const
 
 StochasticProcess1D ()=default
 
 StochasticProcess1D (ext::shared_ptr< discretization >)
 
Size size () const override
 returns the number of dimensions of the stochastic process More...
 
Array initialValues () const override
 returns the initial values of the state variables More...
 
Array drift (Time t, const Array &x) const override
 returns the drift part of the equation, i.e., \( \mu(t, \mathrm{x}_t) \) More...
 
Matrix diffusion (Time t, const Array &x) const override
 returns the diffusion part of the equation, i.e. \( \sigma(t, \mathrm{x}_t) \) More...
 
Array expectation (Time t0, const Array &x0, Time dt) const override
 
Matrix stdDeviation (Time t0, const Array &x0, Time dt) const override
 
Matrix covariance (Time t0, const Array &x0, Time dt) const override
 
Array evolve (Time t0, const Array &x0, Time dt, const Array &dw) const override
 
Array apply (const Array &x0, const Array &dx) const override
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Public Member Functions inherited from StochasticProcess
 ~StochasticProcess () override=default
 
virtual Size factors () const
 returns the number of independent factors of the process More...
 
virtual Time time (const Date &) const
 
void update () override
 
- 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 ()
 
- Protected Member Functions inherited from StochasticProcess
 StochasticProcess ()=default
 
 StochasticProcess (ext::shared_ptr< discretization >)
 
- Protected Attributes inherited from StochasticProcess
ext::shared_ptr< discretizationdiscretization_
 

Detailed Description

1-dimensional stochastic process

This class describes a stochastic process governed by

\[ dx_t = \mu(t, x_t)dt + \sigma(t, x_t)dW_t. \]

Definition at line 163 of file stochasticprocess.hpp.

Constructor & Destructor Documentation

◆ StochasticProcess1D() [1/2]

StochasticProcess1D ( )
protecteddefault

◆ StochasticProcess1D() [2/2]

StochasticProcess1D ( ext::shared_ptr< discretization disc)
explicitprotected

Definition at line 75 of file stochasticprocess.cpp.

Member Function Documentation

◆ x0()

virtual Real x0 ( ) const
pure virtual

◆ drift() [1/2]

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

◆ diffusion() [1/2]

virtual Real diffusion ( Time  t,
Real  x 
) const
pure virtual

◆ expectation() [1/2]

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

returns the expectation \( E(x_{t_0 + \Delta t} | x_{t_0} = 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 ExtendedOrnsteinUhlenbeckProcess, GeneralizedOrnsteinUhlenbeckProcess, GeneralizedBlackScholesProcess, CoxIngersollRossProcess, GsrProcess, HullWhiteProcess, HullWhiteForwardProcess, MfStateProcess, and OrnsteinUhlenbeckProcess.

Definition at line 78 of file stochasticprocess.cpp.

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

◆ stdDeviation() [1/2]

Real stdDeviation ( Time  t0,
Real  x0,
Time  dt 
) const
virtual

returns the standard deviation \( S(x_{t_0 + \Delta t} | x_{t_0} = 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 ExtendedOrnsteinUhlenbeckProcess, GemanRoncoroniProcess, GeneralizedOrnsteinUhlenbeckProcess, GeneralizedBlackScholesProcess, CoxIngersollRossProcess, GsrProcess, HullWhiteProcess, HullWhiteForwardProcess, MfStateProcess, and OrnsteinUhlenbeckProcess.

Definition at line 82 of file stochasticprocess.cpp.

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

◆ variance()

Real variance ( Time  t0,
Real  x0,
Time  dt 
) const
virtual

returns the variance \( V(x_{t_0 + \Delta t} | x_{t_0} = 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 ExtendedOrnsteinUhlenbeckProcess, GeneralizedOrnsteinUhlenbeckProcess, GeneralizedBlackScholesProcess, CoxIngersollRossProcess, HullWhiteProcess, HullWhiteForwardProcess, MfStateProcess, OrnsteinUhlenbeckProcess, and GsrProcess.

Definition at line 86 of file stochasticprocess.cpp.

+ Here is the call graph for this function:

◆ evolve() [1/2]

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

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

\[ E(x_0,t_0,\Delta t) + S(x_0,t_0,\Delta t) \cdot \Delta w \]

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

Reimplemented in ExtendedBlackScholesMertonProcess, GemanRoncoroniProcess, GeneralizedBlackScholesProcess, and CoxIngersollRossProcess.

Definition at line 90 of file stochasticprocess.cpp.

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

◆ apply() [1/2]

Real apply ( Real  x0,
Real  dx 
) const
virtual

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

Reimplemented in GeneralizedBlackScholesProcess, and Merton76Process.

Definition at line 95 of file stochasticprocess.cpp.

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

◆ size()

Size size ( ) const
overrideprivatevirtual

returns the number of dimensions of the stochastic process

Implements StochasticProcess.

Definition at line 245 of file stochasticprocess.hpp.

◆ initialValues()

Array initialValues ( ) const
overrideprivatevirtual

returns the initial values of the state variables

Implements StochasticProcess.

Definition at line 249 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ drift() [2/2]

Array drift ( Time  t,
const Array x 
) const
overrideprivatevirtual

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

Implements StochasticProcess.

Definition at line 254 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ diffusion() [2/2]

Matrix diffusion ( Time  t,
const Array x 
) const
overrideprivatevirtual

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

Implements StochasticProcess.

Definition at line 262 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ expectation() [2/2]

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

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 from StochasticProcess.

Definition at line 270 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ stdDeviation() [2/2]

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

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 from StochasticProcess.

Definition at line 279 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ covariance()

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

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 from StochasticProcess.

Definition at line 288 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ evolve() [2/2]

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

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 from StochasticProcess.

Reimplemented in GemanRoncoroniProcess.

Definition at line 297 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

◆ apply() [2/2]

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

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

Reimplemented from StochasticProcess.

Definition at line 307 of file stochasticprocess.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ discretization_

ext::shared_ptr<discretization> discretization_
protected

Definition at line 228 of file stochasticprocess.hpp.