Stochastic Process API Reference#

StochasticProcess#

class quantflow.sp.base.StochasticProcess#

Base class for stochastic processes in continuous time

analytical_cdf(t: ndarray[Any, dtype[float64]] | float, x: ndarray[Any, dtype[float64]] | float) ndarray[Any, dtype[float64]] | float#

Analytical cdf of the process at time t

Implement if available

analytical_mean(t: ndarray[Any, dtype[float64]] | float) ndarray[Any, dtype[float64]] | float#

Analytical mean of the process at time t

Implement if available

analytical_pdf(t: ndarray[Any, dtype[float64]] | float, x: ndarray[Any, dtype[float64]] | float) ndarray[Any, dtype[float64]] | float#

Analytical pdf of the process at time t

Implement if available

analytical_variance(t: ndarray[Any, dtype[float64]] | float) ndarray[Any, dtype[float64]] | float#

Analytical variance of the process at time t

Implement if available

characteristic(t: ndarray[Any, dtype[float64]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

Characteristic function at time t for a given input parameter

The characteristic function represents the Fourier transform of the probability density function

\[\phi = {\mathbb E} \left[e^{i u x_t}\right]\]
Parameters:
  • t – time horizon

  • u – characteristic function input parameter

abstract characteristic_exponent(t: ndarray[Any, dtype[float64]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

Characteristic exponent at time t for a given input parameter

convexity_correction(t: ndarray[Any, dtype[float64]] | float) int | float | complex | ndarray | Series#

Convexity correction for the process

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

abstract sample(paths: int, time_horizon: float = 1, time_steps: int = 100) Paths#

Generate random paths from the process.

Parameters:
  • paths – Number of paths

  • time_horizon – time horizon

  • time_steps – number of time steps to arrive at horizon

abstract sample_from_draws(draws: Paths, *args: Paths) Paths#

Sample paths from the process given a set of draws

StochasticProcess1d#

IntensityProcess#

class quantflow.sp.base.IntensityProcess(*, rate: Annotated[float, Gt(gt=0)] = 1.0, kappa: Annotated[float, Gt(gt=0)] = 1.0)#

Base class for mean reverting 1D processes which can be used as stochastic intensity

abstract integrated_log_laplace(t: ndarray[Any, dtype[float64]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

The log-Laplace transform of the cumulative process:

\[e^{\phi_{t, u}} = {\mathbb E} \left[e^{i u \int_0^t x_s ds}\right]\]
Parameters:
  • t – time horizon

  • u – frequency

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'kappa': FieldInfo(annotation=float, required=False, default=1.0, description='Mean reversion speed', metadata=[Gt(gt=0)]), 'rate': FieldInfo(annotation=float, required=False, default=1.0, description='Instantaneous initial rate', metadata=[Gt(gt=0)])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

WeinerProcess#

PoissonProcess#

CompoundPoissonProcess#

Heston#

JumpDiffision#