quantdata.sanos.sanos#
SANOS#
- class quantdata.sanos.sanos.SanosFitter(smoothness=None, timeout_seconds=300.0, min_dlv=0.01, max_dlv=50.0, min_density_vol=0.0001, min_density_cap=1e-05, _debug_verbose_cvxpy=None, _eps_price=1e-06, _eps_density=1e-07, _min_density=1e-05, _eps_dlv_box=1e-06, _dlv_mode=True, _raise_on_eps=True)[source]#
Bases:
objectA utility class which generates a “closest” arbitrage-free market using the ideas from the paper https://arxiv.org/pdf/2601.11209.
- timeout_seconds: float | None = 300.0#
Time limit for the optimization solver, in seconds. This is passed to the CVXPY solver options as “time_limit”.
- __call__(expiries, strikes, mids, xstrikes, *, weights=None, vols=None, message_context=None, verbose=<cdxcore.verbose.Context object>)[source]#
Fit SANOS to the market data provided following https://arxiv.org/pdf/2601.11209.
This function performs an L1 closest fit of the SANOS model to the mid prices of the options and returns with
SanosPriceran arbitrage-free surface option pricer.This function is usually very fast, but it can get stuck when the overall surface is close to arbitrage in areas which have very little room to adjust.
- Parameters:
expiries (:class:``numpy.ndarray`) – Increasing array of expiries (in years).
strikes (list[:class:``numpy.ndarray`]) – List of strike arrays, one per expiry. Each strike array must be strictly increasing and positive.
mids (list[:class:``numpy.ndarray`]) – List of mid price arrays, one per expiry.
xstrikes (list[:class:``numpy.ndarray`]) – List of model strikes for which to calibrate a SANOS density for.
weights (list[:class:
numpy.ndarray]|None) – List of weight arrays for themids, used to weight the fit to the mid prices. If None, all weights are set to 1.vols (:class:
numpy.ndarray| float | None, defaultNone) – Volatilities per expiry used whensmoothnessis not None. If left toNone, the function will compute an approximate mid-atm volatility from the provided bid and ask prices per expiry.message_context (str | callable[[], str] | None, default None) – Optional context to prepend to error and warning messages. This can be a string or a callable which returns a string, e.g. a
lambdawhich returns a string with dynamic information such as the current expiry being processed. If None, no context is prepended.verbose (
Context, defaultContext.all) – Verbose context for logging.
- Returns:
Extended market – See above.
- Return type:
dict