Vol Model Calibration¶
quantflow.options.calibration.base.OptionEntry
pydantic-model
¶
Bases: BaseModel
Entry for a single option in the calibration dataset.
Each entry corresponds to a unique (maturity, strike) pair and holds the bid and ask sides as separate OptionPrice objects.
Fields:
-
ttm(float) -
log_strike(float) -
options(list[OptionPrice])
quantflow.options.calibration.base.VolModelCalibration
pydantic-model
¶
Bases: BaseModel, ABC, Generic[M]
Abstract base class for calibration of a stochastic volatility model.
Subclasses must implement get_params, set_params, and get_bounds.
The two-stage fit method is provided here and works for any subclass:
- Stage 1: Nelder-Mead on the scalar
cost_functionto find a good basin. - Stage 2: Levenberg-Marquardt (TRF) on the
residualsvector for precise convergence with bound constraints.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry])
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
get_params
abstractmethod
¶
set_params
abstractmethod
¶
get_bounds
abstractmethod
¶
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
Two-stage fit: Nelder-Mead basin search then LM refinement.
Stage 1 (Nelder-Mead): gradient-free minimisation of cost_function
to reach the right basin of attraction.
Stage 2 (TRF/LM): scipy.optimize.least_squares on the residuals
vector with parameter bounds for precise convergence.
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
penalize
¶
residuals
¶
Weighted residuals per option, in price or implied-vol space.
Controlled by residual_kind:
price:weight * (model_price - mid_price)iv:weight * (model_iv - mid_iv), wheremodel_ivis the Black implied volatility of the model price.
Source code in quantflow/options/calibration/base.py
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
quantflow.options.calibration.heston.HestonCalibration
pydantic-model
¶
Bases: VolModelCalibration[H], Generic[H]
Calibration of the Heston model.
Also serves as the base class for Heston-with-jumps calibration, providing the Feller condition penalty and the core variance-process parameter handling.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry]) -
feller_penalize(float)
feller_penalize
pydantic-field
¶
Penalty weight for violating the Feller condition \(2\kappa\theta \geq \sigma^2\). Applied during the Nelder-Mead stage. Set to 0 to disable.
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
get_bounds
¶
Source code in quantflow/options/calibration/heston.py
get_params
¶
set_params
¶
Source code in quantflow/options/calibration/heston.py
penalize
¶
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
Two-stage fit: Nelder-Mead basin search then LM refinement.
Stage 1 (Nelder-Mead): gradient-free minimisation of cost_function
to reach the right basin of attraction.
Stage 2 (TRF/LM): scipy.optimize.least_squares on the residuals
vector with parameter bounds for precise convergence.
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
residuals
¶
Weighted residuals per option, in price or implied-vol space.
Controlled by residual_kind:
price:weight * (model_price - mid_price)iv:weight * (model_iv - mid_iv), wheremodel_ivis the Black implied volatility of the model price.
Source code in quantflow/options/calibration/base.py
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
quantflow.options.calibration.heston.HestonJCalibration
pydantic-model
¶
Bases: HestonCalibration[HestonJ[D]], Generic[D]
Calibration of the HestonJ model with jumps.
Extends HestonCalibration by appending jump parameters to the parameter vector and bounds.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry]) -
feller_penalize(float)
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
feller_penalize
pydantic-field
¶
Penalty weight for violating the Feller condition \(2\kappa\theta \geq \sigma^2\). Applied during the Nelder-Mead stage. Set to 0 to disable.
get_bounds
¶
Source code in quantflow/options/calibration/heston.py
get_params
¶
Source code in quantflow/options/calibration/heston.py
set_params
¶
Source code in quantflow/options/calibration/heston.py
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
Two-stage fit: Nelder-Mead basin search then LM refinement.
Stage 1 (Nelder-Mead): gradient-free minimisation of cost_function
to reach the right basin of attraction.
Stage 2 (TRF/LM): scipy.optimize.least_squares on the residuals
vector with parameter bounds for precise convergence.
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
penalize
¶
residuals
¶
Weighted residuals per option, in price or implied-vol space.
Controlled by residual_kind:
price:weight * (model_price - mid_price)iv:weight * (model_iv - mid_iv), wheremodel_ivis the Black implied volatility of the model price.
Source code in quantflow/options/calibration/base.py
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
quantflow.options.calibration.heston.DoubleHestonCalibration
pydantic-model
¶
Bases: VolModelCalibration[DH], Generic[DH]
Calibration of the DoubleHeston model.
The parameter vector is
[rate1, theta1, kappa_delta, sigma1, rho1, rate2, theta2, kappa2, sigma2, rho2]
where kappa1 = kappa2 + kappa_delta with kappa_delta > 0, enforcing that
the first (short-maturity) process always mean-reverts faster than the second.
The Feller penalty is applied independently to both variance processes. A warm start fits each process independently to its natural maturity range before the joint optimisation.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry]) -
feller_penalize(float) -
ttm_split(float | None)
feller_penalize
pydantic-field
¶
Penalty weight for violating the Feller condition \(2\kappa\theta \geq \sigma^2\). Applied during the L-BFGS-B stage. Set to 0 to disable.
ttm_split
pydantic-field
¶
TTM threshold in years separating short-maturity options (fitted to heston1) from long-maturity options (fitted to heston2) during warm start. Defaults to the median TTM across all calibration options.
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
maturity_split
¶
TTM split to use for warm start: explicit value or median of option TTMs.
Source code in quantflow/options/calibration/heston.py
get_bounds
¶
Source code in quantflow/options/calibration/heston.py
get_params
¶
Source code in quantflow/options/calibration/heston.py
set_params
¶
Source code in quantflow/options/calibration/heston.py
feller_residuals
¶
Extra residual terms penalising Feller violations for both processes.
Appended to the main residual vector so the TRF stage also sees the constraint, not just the L-BFGS-B stage.
Source code in quantflow/options/calibration/heston.py
penalize
¶
Feller penalty applied independently to both variance processes
Source code in quantflow/options/calibration/heston.py
residuals
¶
warm_start
¶
Sequential single-Heston fits to initialise the joint optimisation.
Fits heston2 to long-dated options (ttm > split) then heston1 to short-dated options (ttm <= split), where the split defaults to the median TTM across all calibration options.
Source code in quantflow/options/calibration/heston.py
fit
¶
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
quantflow.options.calibration.heston.DoubleHestonJCalibration
pydantic-model
¶
Bases: DoubleHestonCalibration[DoubleHestonJ[D]], Generic[D]
Calibration of the DoubleHestonJ model.
Extends
DoubleHestonCalibration
by appending the jump parameters of heston1 to the parameter vector and bounds.
Overrides warm_start to fit a full
HestonJCalibration
to the short-dated options, so that the jump parameters are also initialised
before the joint optimisation.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry]) -
feller_penalize(float) -
ttm_split(float | None)
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
feller_penalize
pydantic-field
¶
Penalty weight for violating the Feller condition \(2\kappa\theta \geq \sigma^2\). Applied during the L-BFGS-B stage. Set to 0 to disable.
ttm_split
pydantic-field
¶
TTM threshold in years separating short-maturity options (fitted to heston1) from long-maturity options (fitted to heston2) during warm start. Defaults to the median TTM across all calibration options.
get_bounds
¶
Source code in quantflow/options/calibration/heston.py
get_params
¶
Source code in quantflow/options/calibration/heston.py
set_params
¶
Source code in quantflow/options/calibration/heston.py
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
penalize
¶
Feller penalty applied independently to both variance processes
Source code in quantflow/options/calibration/heston.py
residuals
¶
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
maturity_split
¶
TTM split to use for warm start: explicit value or median of option TTMs.
Source code in quantflow/options/calibration/heston.py
feller_residuals
¶
Extra residual terms penalising Feller violations for both processes.
Appended to the main residual vector so the TRF stage also sees the constraint, not just the L-BFGS-B stage.
Source code in quantflow/options/calibration/heston.py
warm_start
¶
Sequential single-Heston fits to initialise the joint optimisation.
Fits heston2 to long-dated options (ttm > split) then heston1 to short-dated options (ttm <= split), where the split defaults to the median TTM across all calibration options.
Source code in quantflow/options/calibration/heston.py
quantflow.options.calibration.bns.BNSCalibration
pydantic-model
¶
Bases: VolModelCalibration[B], Generic[B]
Calibration of the BNS stochastic volatility model.
The parameter vector is [v0, theta, kappa, beta, rho] where
v0is the initial variance (\(v_0 = \text{variance\_process.rate}\))thetais the long-run variance (\(\theta = \lambda / \beta\))kappais the mean-reversion speed of the variance processbetais the exponential decay of the BDLP jump-size distributionrhois the leverage parameter (correlation between jumps in variance and jumps in log-price)
The BDLP intensity is set as \(\lambda = \theta \beta\) so that the stationary mean of the variance process equals \(\theta\), mirroring the Heston parameterisation. The Gamma-OU variance process is positive by construction, so no Feller-style penalty is needed.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry])
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
get_bounds
¶
Source code in quantflow/options/calibration/bns.py
get_params
¶
set_params
¶
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
Two-stage fit: Nelder-Mead basin search then LM refinement.
Stage 1 (Nelder-Mead): gradient-free minimisation of cost_function
to reach the right basin of attraction.
Stage 2 (TRF/LM): scipy.optimize.least_squares on the residuals
vector with parameter bounds for precise convergence.
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
penalize
¶
residuals
¶
Weighted residuals per option, in price or implied-vol space.
Controlled by residual_kind:
price:weight * (model_price - mid_price)iv:weight * (model_iv - mid_iv), wheremodel_ivis the Black implied volatility of the model price.
Source code in quantflow/options/calibration/base.py
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid
Source code in quantflow/options/calibration/base.py
quantflow.options.calibration.bns.BNS2Calibration
pydantic-model
¶
Bases: VolModelCalibration[B2], Generic[B2]
Calibration of the BNS2 two-factor BNS model.
Following the BNS superposition-of-OU construction, both factors share the same Gamma stationary marginal: only the mean-reversion timescales and the leverage parameters differ between the fast and slow factors. The parameter vector has nine entries:
[v01, v02, theta, beta, kappa2, kappa_delta, rho1, rho2, w]
| Symbol | Description |
|---|---|
v01, v02 |
Initial variances of the two factors |
theta |
Long-run variance shared by both factors (\(\theta = \lambda / \beta\)) |
beta |
Exponential decay of the BDLP jump-size distribution (shared) |
kappa2 |
Mean-reversion speed of the slow factor |
kappa_delta |
Excess speed of the fast factor (\(\kappa_1 - \kappa_2\)) |
rho1, rho2 |
Leverage of the two factors, free in \([-0.9, 0.9]\) |
w |
Weight of the first variance factor in the convex combination |
Tying \((\theta, \beta)\) removes the degeneracy between the two marginal-distribution parameters and the timescales: the long-dated smile pins down a single stationary variance distribution, while the term structure of vol identifies the two relaxation speeds. The leverages \(\rho_1, \rho_2\) stay independent because the empirical equity skew flattens with maturity, which a single shared leverage cannot reproduce.
The user-supplied initial model still seeds the fit: pick distinct
timescales for bns1 and bns2 (and consider opposite-sign leverages) so
the optimiser starts away from the single-factor collapse. Any difference
in (theta, beta) between the two seed factors is averaged when building
the starting parameter vector.
Fields:
-
pricer(OptionPricerBase) -
vol_surface(VolSurface[Any]) -
residual_kind(ResidualKind) -
moneyness_weight(float) -
max_cost_weight(float) -
options(dict[ModelCalibrationEntryKey, OptionEntry])
residual_kind
pydantic-field
¶
Kind of residual used by the calibration cost function. price (default) measures the residual on forward-space option prices and applies the moneyness_weight cost weights; iv measures it on Black implied volatilities by inverting the model price. The iv residual is already in vol units and is naturally well-scaled across moneyness, so the moneyness_weight cost weights are not applied in that mode.
moneyness_weight
pydantic-field
¶
Coefficient that up-weights wing options in the cost function. Applied as min(exp(moneyness_weight * moneyness**2), max_cost_weight), with moneyness = log(K/F) / sqrt(ttm). The quadratic form mimics the gaussian shape of 1/vega and puts wing residuals on the same footing as ATM ones. A value of 0 applies no moneyness weighting; typical values are in [0.1, 0.5].
max_cost_weight
pydantic-field
¶
Hard cap on the per-option cost weight, to prevent a single deep-wing option from dominating the loss when moneyness_weight is large.
get_bounds
¶
Source code in quantflow/options/calibration/bns.py
get_params
¶
Source code in quantflow/options/calibration/bns.py
set_params
¶
Source code in quantflow/options/calibration/bns.py
implied_vol_range
¶
Range of implied volatilities across all calibration options
Source code in quantflow/options/calibration/base.py
fit
¶
Two-stage fit: Nelder-Mead basin search then LM refinement.
Stage 1 (Nelder-Mead): gradient-free minimisation of cost_function
to reach the right basin of attraction.
Stage 2 (TRF/LM): scipy.optimize.least_squares on the residuals
vector with parameter bounds for precise convergence.
Source code in quantflow/options/calibration/base.py
cost_weight
¶
Weight for a given time to maturity and log-strike.
Up-weights wing options via exp(moneyness_weight * moneyness**2),
capped at max_cost_weight. The quadratic form mimics 1/vega.
Source code in quantflow/options/calibration/base.py
cost_weights
¶
Vector of cost weights for all calibration options
penalize
¶
residuals
¶
Weighted residuals per option, in price or implied-vol space.
Controlled by residual_kind:
price:weight * (model_price - mid_price)iv:weight * (model_iv - mid_iv), wheremodel_ivis the Black implied volatility of the model price.
Source code in quantflow/options/calibration/base.py
cost_function
¶
Scalar cost: sum of squared residuals plus any penalty
plot
¶
Plot implied volatility for market and model prices
Source code in quantflow/options/calibration/base.py
plot_maturities
¶
plot_maturities(*, max_moneyness=1.0, support=51, cols=2, row_height=400, showlegend=False, **kwargs)
Plot implied volatility for all maturities as a subplot grid