quantdata.dysanos.grid.torch_pricer#

SANOS (Torch)#

Fitting the DLVs of SANOS.

class quantdata.dysanos.grid.torch_pricer.SanosDecoderConfig(smoothness=None, num_state=20, num_nms=20, learn_nms=False, nms_range=(-2, 1), nms_eps=None, min_dlv=0.009, max_dlv=3.0, min_fvol=0.01, max_fvol=2.0, nn_config=FeedForwardConfig(activation='Softplus', num_depth=0, num_width=16, use_bias=True), _xnms_scale=2.0)[source]#

Bases: object

smoothness: float | None = None#
num_state: int = 20#
num_nms: int = 20#
learn_nms: bool = False#
nms_range: tuple[float, float] = (-2, 1)#
nms_eps: float | None = None#
min_dlv: float = 0.009#
max_dlv: float = 3.0#
min_fvol: float = 0.01#
max_fvol: float = 2.0#
nn_config: FeedForwardConfig = FeedForwardConfig(activation='Softplus', num_depth=0, num_width=16, use_bias=True)#
property str_smooth: str#
property nms_str: str#
property minmax_str#
property state_str: str#
property xnms: ndarray#

Generate NMS strikes which contain ‘1’

class quantdata.dysanos.grid.torch_pricer.SanosPricer(*, smoothness, expiries, xstrikes, xdensities, xdensity0, sqrtVars, dlvsqs=None, xnms=None, debug=False)[source]#

Bases: object

verify(condition, message)[source]#

verify condition and raise an error with message if not satisfied; if self.debug is False, this function does nothing.

property strikes: Tensor#

Return the strikes (S, T, N) this model was trained

static create(smoothness, model_output, *, debug=False)[source]#

Create a SanosPricer from the output of a SanosDecoder

__call__(market_strikes, *, dt=None, training=False)[source]#

Price call prices for the provided market strikes

asdict()[source]#

Return a dictionary representation of the SanosPricer

class quantdata.dysanos.grid.torch_pricer.SanosDecoder(env, num_expiries, *, config)[source]#

Bases: BaseModel

SANOS functional which decodes a state of num_state elements into SANOS parameters, returned as a SanosPricer object.

The decoder is a feedforward neural network with num_state inputs and num_output outputs, where num_output is determined by the number of expiries and the number of moneyness levels.

__call__(state, expiries, *, training=False)[source]#

Decode a state into dlvsqs and foward variances.