quantmetrics.price_calculators.gbm_pricing.gbm_calculator.GBMCalculator
- class quantmetrics.price_calculators.gbm_pricing.gbm_calculator.GBMCalculator(model: LevyModel, option: Option)[source]
Calculator for option pricing under the Geometric Brownian Motion (GBM) model.
This class provides a unified interface for computing option prices and related quantities using the GBM model. It leverages several specialized classes to perform tasks such as computing the closed-form solution for European options, evaluating the characteristic function (useful for Fourier-based methods), and simulating asset price paths under GBM dynamics.
Parameters
- modelLevyModel
An instance of a Levy model that defines the underlying asset dynamics, including parameters such as the initial asset price (S0) and volatility (sigma).
- optionOption
An instance of an Option containing parameters such as the risk-free rate (r), dividend yield (q), time to maturity (T), strike price (K), and payoff type.
Methods
- calculate_closed_form()Union[float, np.ndarray]
Computes the option price using the closed-form solution for the GBM model.
- calculate_characteristic_function(unp.ndarray)np.ndarray
Evaluates the characteristic function of the GBM model at the provided input values. This is typically used in Fourier-based pricing methods.
- simulate_paths_Q(num_timestepsint, num_pathsint, seedint)dict
Simulates asset price paths of the GBM dynamics the risk-neutral measure \(\mathbb{Q}\). Returns a dictionary with keys:
‘time’: 1D array of time points.
‘S’: The exact solution paths (via the multiplicative formula).
‘S_euler’: The Euler–Maruyama approximation paths.
Methods
__init__
(model, option)calculate_characteristic_function
(u)calculate_closed_form
()simulate_paths_Q
(num_timesteps, num_paths, seed)