Heston process¶
quantflow.sp.heston.Heston
pydantic-model
¶
Bases: StochasticProcess1D
The Heston stochastic volatility model
The classical square-root stochastic volatility model of Heston (1993) can be regarded as a standard Brownian motion \(x_t\) time changed by a CIR activity rate process.
Fields:
-
variance_process(CIR) -
rho(float)
variance_process
pydantic-field
¶
The variance process is a Cox-Ingersoll-Ross process which is guaranteed to be positive if the Feller condition is satisfied
rho
pydantic-field
¶
Correlation between the Brownian motions, it provides the leverage effect and therefore the skewness of the distribution
create
classmethod
¶
Create an Heston model.
To understand the parameters lets introduce the following notation:
| PARAMETER | DESCRIPTION |
|---|---|
rate
|
Initial rate of the variance process
TYPE:
|
vol
|
Volatility of the price process, normalized by the square root of time, as time tends to infinity (the long term standard deviation)
TYPE:
|
kappa
|
Mean reversion speed for the variance process, the lower the more pronounced the volatility clustering and therefore the fatter the tails of the distribution of the price process
TYPE:
|
sigma
|
Volatility of the variance process (a.k.a. the vol of vol)
TYPE:
|
rho
|
Correlation between the Brownian motions of the variance and price processes
TYPE:
|
theta
|
Long-term mean of the variance process. If
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic_exponent
¶
Characteristic exponent of the Heston model in closed form.
Define the correlation-adjusted drift and the characteristic frequency:
Then the exponent is
where
and \(\nu\) is the vol of vol, \(\kappa\) the mean-reversion speed, \(\theta\) the long-term variance, \(\rho\) the correlation, and \(v_0\) the initial variance.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon or array of evaluation times
TYPE:
|
u
|
Characteristic exponent argument
TYPE:
|
Source code in quantflow/sp/heston.py
sample
¶
| PARAMETER | DESCRIPTION |
|---|---|
n
|
Number of sample paths
TYPE:
|
time_horizon
|
Time horizon
TYPE:
|
time_steps
|
Number of discrete time steps
TYPE:
|
Source code in quantflow/sp/heston.py
sample_from_draws
¶
| PARAMETER | DESCRIPTION |
|---|---|
path1
|
Pre-drawn standard normal increments for the first Brownian motion
TYPE:
|
*args
|
Optional pre-drawn increments for the second Brownian motion; new draws are generated if omitted
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic
¶
Characteristic function at time t for a given input parameter u
The characteristic function represents the Fourier transform of the probability density function
where \(\phi\) is the characteristic exponent, which can be more easily computed for many processes.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon
TYPE:
|
u
|
Characteristic function input parameter
TYPE:
|
Source code in quantflow/sp/base.py
convexity_correction
¶
analytical_std
¶
Analytical standard deviation of the process at time t
This has a closed form solution if the process has an analytical variance
analytical_mean
¶
analytical_variance
¶
analytical_pdf
¶
analytical_cdf
¶
marginal
¶
domain_range
¶
frequency_range
¶
Maximum frequency when calculating characteristic functions
Source code in quantflow/sp/base.py
support
¶
Support of the process at time t
Source code in quantflow/sp/base.py
quantflow.sp.heston.HestonJ
pydantic-model
¶
Bases: Heston, Generic[D]
A generic Heston stochastic volatility model with jumps
The Heston model with jumps is an extension of the classical square-root stochastic volatility model of Heston (1993) with the addition of jump processes. The jumps are modeled via a compound Poisson process
This model is generic and therefore allows for different types of jumps distributions D.
The Bates model is obtained by using the Normal distribution for the jump sizes.
Fields:
-
variance_process(CIR) -
rho(float) -
jumps(CompoundPoissonProcess[D])
variance_process
pydantic-field
¶
The variance process is a Cox-Ingersoll-Ross process which is guaranteed to be positive if the Feller condition is satisfied
rho
pydantic-field
¶
Correlation between the Brownian motions, it provides the leverage effect and therefore the skewness of the distribution
create
classmethod
¶
create(jump_distribution, *, rate=1.0, vol=0.5, kappa=1, sigma=0.8, rho=0, theta=None, jump_intensity=100, jump_fraction=0.1, jump_asymmetry=0.0)
Create an Heston model with DoubleExponential jumps.
To understand the parameters lets introduce the following notation:
| PARAMETER | DESCRIPTION |
|---|---|
jump_distribution
|
The distribution of jump size (currently only Normal and DoubleExponential are supported)
TYPE:
|
rate
|
Define the initial value of the variance process
TYPE:
|
vol
|
The standard deviation of the price process, normalized by the square root of time, as time tends to infinity (the long term standard deviation)
TYPE:
|
kappa
|
The mean reversion speed for the variance process
TYPE:
|
sigma
|
The volatility of the variance process
TYPE:
|
rho
|
The correlation between the Brownian motions of the variance and price processes
TYPE:
|
theta
|
The long-term mean of the variance process, if
TYPE:
|
jump_intensity
|
The average number of jumps per year
TYPE:
|
jump_fraction
|
The fraction of variance due to jumps (between 0 and 1)
TYPE:
|
jump_asymmetry
|
The asymmetry of the jump distribution (0 for symmetric jumps)
TYPE:
|
Source code in quantflow/sp/heston.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
characteristic_exponent
¶
Characteristic exponent as the sum of the Heston and jump exponents.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon or array of evaluation times
TYPE:
|
u
|
Characteristic exponent argument (imaginary frequency)
TYPE:
|
Source code in quantflow/sp/heston.py
sample_from_draws
¶
Source code in quantflow/sp/heston.py
sample
¶
| PARAMETER | DESCRIPTION |
|---|---|
n
|
Number of sample paths
TYPE:
|
time_horizon
|
Time horizon
TYPE:
|
time_steps
|
Number of discrete time steps
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic
¶
Characteristic function at time t for a given input parameter u
The characteristic function represents the Fourier transform of the probability density function
where \(\phi\) is the characteristic exponent, which can be more easily computed for many processes.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon
TYPE:
|
u
|
Characteristic function input parameter
TYPE:
|
Source code in quantflow/sp/base.py
convexity_correction
¶
analytical_std
¶
Analytical standard deviation of the process at time t
This has a closed form solution if the process has an analytical variance
analytical_mean
¶
analytical_variance
¶
analytical_pdf
¶
analytical_cdf
¶
marginal
¶
domain_range
¶
frequency_range
¶
Maximum frequency when calculating characteristic functions
Source code in quantflow/sp/base.py
support
¶
Support of the process at time t
Source code in quantflow/sp/base.py
quantflow.sp.heston.DoubleHeston
pydantic-model
¶
Bases: StochasticProcess1D
Double Heston stochastic volatility model.
Two independent Heston processes drive a single log-price:
Because the two components are independent, the characteristic exponent is the sum of the two individual Heston exponents.
Fields:
characteristic_exponent
¶
Characteristic exponent as the sum of two independent Heston exponents.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon or array of evaluation times
TYPE:
|
u
|
Characteristic exponent argument (imaginary frequency)
TYPE:
|
Source code in quantflow/sp/heston.py
sample
¶
| PARAMETER | DESCRIPTION |
|---|---|
n
|
Number of sample paths
TYPE:
|
time_horizon
|
Time horizon
TYPE:
|
time_steps
|
Number of discrete time steps
TYPE:
|
Source code in quantflow/sp/heston.py
sample_from_draws
¶
| PARAMETER | DESCRIPTION |
|---|---|
path1
|
First Brownian motion draws for heston1
TYPE:
|
*args
|
args[0]: second BM draws for heston1; args[1], args[2]: first and second BM draws for heston2
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic
¶
Characteristic function at time t for a given input parameter u
The characteristic function represents the Fourier transform of the probability density function
where \(\phi\) is the characteristic exponent, which can be more easily computed for many processes.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon
TYPE:
|
u
|
Characteristic function input parameter
TYPE:
|
Source code in quantflow/sp/base.py
convexity_correction
¶
analytical_std
¶
Analytical standard deviation of the process at time t
This has a closed form solution if the process has an analytical variance
analytical_mean
¶
analytical_variance
¶
analytical_pdf
¶
analytical_cdf
¶
marginal
¶
domain_range
¶
frequency_range
¶
Maximum frequency when calculating characteristic functions
Source code in quantflow/sp/base.py
support
¶
Support of the process at time t
Source code in quantflow/sp/base.py
quantflow.sp.heston.DoubleHestonJ
pydantic-model
¶
Bases: DoubleHeston, Generic[D]
Double Heston stochastic volatility model with jumps.
Extends DoubleHeston by replacing the first (short-maturity) Heston process with a HestonJ that carries a jump component. Jumps are assigned to the short end because they fade away at longer maturities:
where \(\phi^{(1)}\) and \(\phi^{\text{jumps}}\) are both provided by the HestonJ first process.
Fields:
sample_from_draws
¶
| PARAMETER | DESCRIPTION |
|---|---|
path1
|
First Brownian motion draws for heston1
TYPE:
|
*args
|
args[0]: second BM draws for heston1; args[1], args[2]: first and second BM draws for heston2
TYPE:
|
Source code in quantflow/sp/heston.py
sample
¶
| PARAMETER | DESCRIPTION |
|---|---|
n
|
Number of sample paths
TYPE:
|
time_horizon
|
Time horizon
TYPE:
|
time_steps
|
Number of discrete time steps
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic_exponent
¶
Characteristic exponent as the sum of two independent Heston exponents.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon or array of evaluation times
TYPE:
|
u
|
Characteristic exponent argument (imaginary frequency)
TYPE:
|
Source code in quantflow/sp/heston.py
characteristic
¶
Characteristic function at time t for a given input parameter u
The characteristic function represents the Fourier transform of the probability density function
where \(\phi\) is the characteristic exponent, which can be more easily computed for many processes.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time horizon
TYPE:
|
u
|
Characteristic function input parameter
TYPE:
|
Source code in quantflow/sp/base.py
convexity_correction
¶
analytical_std
¶
Analytical standard deviation of the process at time t
This has a closed form solution if the process has an analytical variance
analytical_mean
¶
analytical_variance
¶
analytical_pdf
¶
analytical_cdf
¶
marginal
¶
domain_range
¶
frequency_range
¶
Maximum frequency when calculating characteristic functions
Source code in quantflow/sp/base.py
support
¶
Support of the process at time t