Levy Models
The levy_models module provides a collection of stochastic models for option pricing.
Modules
geometric_brownian_motion.py: Implements the geometric Brownian motion (GBM) model.
constant_jump_diffusion.py: Implements the constant jump-diffusion (CJD) model.
lognormal_jump_diffusion,py: Implements the lognormal jump-diffusion (LJD) model.
double_exponential_jump_diffusion.py: Implements the double-exponential jump-diffusion (DEJD) model.
variance_gamma.py: Implements the Variance Gamma (VG) model.
Classes
Below are the key classes defined in this module:
GeometricBrownianMotion
Implements the GBM stochastic process for modeling asset prices.
- class quantmetrics.levy_models.geometric_brownian_motion.GeometricBrownianMotion(S0: float = 50, mu: float = 0.05, sigma: float = 0.2)[source]
Bases:
LevyModel
Geometric Brownian motion model.
Parameters
- S0float
Initial stock price.
- mufloat
Expected return (drift).
- sigmafloat
Volatility (annualized). Divide by the square root of the number of days in a year (e.g., 360) to convert to daily.
- fit(data: ndarray, method: str = 'Nelder-Mead', init_params: ndarray = None, brute_tuple: tuple = ((-1, 1, 0.5), (0.05, 2, 0.5)))[source]
Fit the Geometric Brownian Motion model to the data using Maximum Likelihood Estimation (MLE).
Parameters
- datanp.ndarray
The data points to fit the model.
- methodstr
The minimization method, defualt is “Nelder-Mead”.
- init_paramsnp.ndarray
A 2x1-dimensional numpy array containing the initial estimates for the drift (mu) and volatility (sigma).
- brute_tupletuple
If initial parameters are not specified, the brute function is applied with a 2x3-dimensional tuple for each parameter as (start value, end value, step size).
Returns
- minimize
The result of the minimization process containing the estimated parameters.
- property model_params_conds_valid
- property mu: float
- pdf(data: ndarray, est_params: ndarray) ndarray [source]
Probability density function for the Geometric Brownian Motion model.
Parameters
- datanp.ndarray
The data points for which the PDF is calculated.
- est_paramsnp.ndarray
Estimated parameters (mu, sigma).
Returns
- np.ndarray
The probability density values.
- property sigma: float
ConstantJumpDiffusion
Implements the constant jump diffusion model.
- class quantmetrics.levy_models.constant_jump_diffusion.ConstantJumpDiffusion(S0: float = 50, mu: float = 0.05, sigma: float = 0.2, lambda_: float = 1, gamma: float = -0.1, N: int = 10)[source]
Bases:
LevyModel
Constant jump-diffusion model.
Parameters
- S0float
Initial stock price.
- mufloat
Expected return (drift).
- sigmafloat
Volatility (annualized). Divide by the square root of the number of days in a year (e.g., 360) to convert to daily.
lambda_
floatJump intensity rate is strictly greater than zero.
- gammafloat
Mean jump size is strictly greater than -1 and non-zero.
- Nint
Number of big jumps (the Poisson jumps).
- fit(data: ndarray, method: str = 'Nelder-Mead', init_params: ndarray | None = None, brute_tuple: tuple = ((-1, 1, 0.5), (0.05, 2, 0.5), (0.1, 0.401, 0.1), (-0.5, 1, 0.1)))[source]
Fit the constant jump-diffusion model to the data using Maximum Likelihood Estimation (MLE).
Parameters
- datanp.ndarray
The data points to fit the model.
- methodstr
The minimization method, defualt is “Nelder-Mead”. Other options are the same as for the minimize function from scipy.optimize.
- init_paramsnp.ndarray
A 4x1-dimensional numpy array containing the initial estimates for the drift (mu) and volatility (sigma).
- brute_tupletuple
If initial parameters are not specified, the brute function is applied with a 4x3-dimensional tuple for each parameter as (start value, end value, step size).
Returns
- minimize
The result of the minimization process containing the estimated parameters.
- property gamma: float
- property lambda_: float
- property model_params_conds_valid
- property mu: float
- pdf(data: ndarray, est_params: ndarray) ndarray [source]
Probability density function for the constant jump-diffusion model.
Parameters
- datanp.ndarray
The data points for which the PDF is calculated.
- est_paramsnp.ndarray
Estimated parameters (mu, sigma, lambda, gamma).
Returns
- np.ndarray
The probability density values.
- property sigma: float
LognormalJumpDiffusion
Implements the lognormal jump-diffusion model.
- class quantmetrics.levy_models.lognormal_jump_diffusion.LognormalJumpDiffusion(S0: float = 50, mu: float = 0.05, sigma: float = 0.2, lambda_: float = 1, muJ: float = -0.1, sigmaJ: float = 0.1, N: int = 10)[source]
Bases:
LevyModel
Lognormal jump-diffusion model.
Parameters
- S0float
Initial stock price.
- mufloat
Expected return (drift).
- sigmafloat
Volatility (annualized). Divide by the square root of the number of days in a year (e.g., 360) to convert to daily.
lambda_
floatJump intensity rate is strictly greater than zero.
- muJfloat
Mean jump size is strictly greater than -1 and non-zero.
- sigmaJfloat
Standard deviation of the jump size. It is a positive number.
- Nint
Number of big jumps (the Poisson jumps).
- fit(data: ndarray, method: str = 'Nelder-Mead', init_params: ndarray | None = None, brute_tuple: tuple = ((-1, 1, 0.5), (0.05, 2, 0.5), (0.1, 0.401, 0.1), (-0.5, 1, 0.1), (0.05, 5, 0.5)))[source]
Fit the constant jump-diffusion model to the data using Maximum Likelihood Estimation (MLE).
Parameters
- datanp.ndarray
The data points to fit the model.
- methodstr
The minimization method, defualt is “Nelder-Mead”. Other options are the same as for the minimize function from scipy.optimize.
- init_paramsnp.ndarray
A 5x1-dimensional numpy array containing the initial estimates for the drift (mu) and volatility (sigma).
- brute_tupletuple
If initial parameters are not specified, the brute function is applied with a 5x3-dimensional tuple for each parameter as (start value, end value, step size).
Returns
- minimize
The result of the minimization process containing the estimated parameters.
- property lambda_: float
- property model_params_conds_valid
- property mu: float
- property muJ: float
- pdf(data: ndarray, est_params: ndarray) ndarray [source]
Probability density function for the lognormal jump-diffusion model.
Parameters
- datanp.ndarray
The data points for which the PDF is calculated.
- est_paramsnp.ndarray
Estimated parameters (mu, sigma, lambda, muJ, sigmaJ).
Returns
- np.ndarray
The probability density values.
- property sigma: float
- property sigmaJ: float
DoubleExponentialJumpDiffusion
Implements the double-exponential jump-diffusion model.
- class quantmetrics.levy_models.double_exponential_jump_diffusion.DoubleExponentialJumpDiffusion(S0: float = 100, mu: float = 0.05, sigma: float = 0.16, lambda_: float = 1, eta1: float = 10, eta2: float = 5, p: float = 0.4, N: int = 10)[source]
Bases:
LevyModel
Double exponential jump-diffusion model.
Parameters
- S0float
Initial stock price.
- mufloat
Expected return (drift).
- sigmafloat
Volatility (annualized). Divide by the square root of the number of days in a year (e.g., 360) to convert to daily.
lambda_
floatJump intensity rate is strictly greater than zero.
- eta1float
to be defined
- eta2float
to be defined
- pfloat
to be defined
- Nint
Number of big jumps (the Poisson jumps).
References
Kou, S. G. (2002). A jump-diffusion model for option pricing. Management science, 48(8), 1086-1101. Ramezani, C. A., & Zeng, Y. (2007). Maximum likelihood estimation of the double exponential jump-diffusion process. Annals of Finance, 3, 487-507.
Examples
- property eta1: float
- property eta2: float
- fit(data: ndarray, method: str = 'Nelder-Mead', init_params: ndarray | None = None, brute_tuple: tuple = ((-1, 1, 0.5), (0.05, 2, 0.5), (0.1, 0.401, 0.1), (-0.5, 1, 0.1), (0.05, 5, 0.5)))[source]
Fit the constant jump-diffusion model to the data using Maximum Likelihood Estimation (MLE).
Parameters
- datanp.ndarray
The data points to fit the model.
- methodstr
The minimization method, defualt is “Nelder-Mead”. Other options are the same as for the minimize function from scipy.optimize.
- init_paramsnp.ndarray
A 5x1-dimensional numpy array containing the initial estimates for the drift (mu) and volatility (sigma).
- brute_tupletuple
If initial parameters are not specified, the brute function is applied with a 5x3-dimensional tuple for each parameter as (start value, end value, step size).
Returns
- minimize
The result of the minimization process containing the estimated parameters.
- property lambda_: float
- property model_params_conds_valid
- property mu: float
- property p: float
- pdf(data: ndarray, est_params: ndarray) ndarray [source]
Probability density function for the lognormal jump-diffusion model.
Parameters
- datanp.ndarray
The data points for which the PDF is calculated.
- est_paramsnp.ndarray
Estimated parameters (mu, sigma, lambda, muJ, sigmaJ).
Returns
- np.ndarray
The probability density values.
- property sigma: float
VarianceGamma
Implements the Variance Gamma model for stochastic processes.
- class quantmetrics.levy_models.variance_gamma.VarianceGamma(S0: float = 50, mu: float = 0.05, m: float = -0.1, delta: float = 0.2, kappa: float = 0.1)[source]
Bases:
LevyModel
Variance Gamma model.
Parameters
- S0float
Initial stock price.
- mufloat
Expected return (drift).
- mfloat
Drift of the subordinated Brownian motion at a random time given by a Gamma process. If m = 0, then we have a symmetric variance gamma distribution.
- deltafloat
Volatility of the subordinated Brownian motion at a random time given by a Gamma process.
- kappafloat
Variance rate of the subordinator Gamma process.
- property delta: float
- fit(data: ndarray, method: str = 'Nelder-Mead', init_params: ndarray | None = None, brute_tuple: tuple = ((-1, 1, 0.5), (-1, 1, 0.5), (0.05, 2.05, 0.5), (0.3, 0.5, 0.1)))[source]
Fit the variance Gamma model to the data using Maximum Likelihood Estimation (MLE).
Parameters
- datanp.ndarray
The data points to fit the model.
- methodstr
The minimization method, defualt is “Nelder-Mead”. Other options are the same as for the minimize function from scipy.optimize.
- init_paramsnp.ndarray
A 5x1-dimensional numpy array containing the initial estimates for the drift (mu) and volatility (sigma).
- brute_tupletuple
If initial parameters are not specified, the brute function is applied with a 5x3-dimensional tuple for each parameter as (start value, end value, step size).
Returns
- minimize
The result of the minimization process containing the estimated parameters.
- property kappa: float
- property m: float
- property model_params_conds_valid
- property mu: float
- pdf(data: ndarray, est_params: ndarray) ndarray [source]
Probability density function for the Variance Gamma model.
Parameters
- datanp.ndarray
The data points for which the PDF is calculated.
- est_paramsnp.ndarray
Estimated parameters (mu, m, delta, kappa).
Returns
- np.ndarray
The probability density values.