quantdata.dysanos.grid.gendysanos.cell_measure_change#

Independent trading-time/expiry policies for utility measure changes.

class quantdata.dysanos.grid.gendysanos.cell_measure_change.CellMeasureChangeConfig(*, label, source_cache_uid, state_features, risk_aversion, utility, trading_times=10, expiries=7, instruments_per_expiry=21, group='', user_version='0.1', network_config=FeedForwardConfig(activation='SiLU', num_depth=2, num_width=64, use_bias=True))[source]#

Bases: object

Logical geometry of 70 mutually independent conditional policies.

trading_times: int = 10#
expiries: int = 7#
instruments_per_expiry: int = 21#
group: str = ''#
user_version: str = '0.1'#
network_config: FeedForwardConfig = FeedForwardConfig(activation='SiLU', num_depth=2, num_width=64, use_bias=True)#
property filename: str#
class quantdata.dysanos.grid.gendysanos.cell_measure_change.CellMeasureChangeTrainConfig(*, batch_size=4096, valuation_batch_size=16384, epochs=20000, minimum_epochs=5000, value_update=500, checkpoint_update=2000, lr=0.0003, weight_decay=0.0, compile=True, convergence_points=8, convergence_relative_tolerance=0.0002, seed=82061)[source]#

Bases: object

Operational training settings which permit checkpoint warm starts.

batch_size: int = 4096#
valuation_batch_size: int = 16384#
epochs: int = 20000#
minimum_epochs: int = 5000#
value_update: int = 500#
checkpoint_update: int = 2000#
lr: float = 0.0003#
weight_decay: float = 0.0#
compile: bool = True#
convergence_points: int = 8#
convergence_relative_tolerance: float = 0.0002#
seed: int = 82061#
class quantdata.dysanos.grid.gendysanos.cell_measure_change.IndependentCellAction(env, *, config, state_mean, state_scale, return_rms)[source]#

Bases: BaseModel

One unbounded, preconditioned network for every (t, expiry) cell.

zero_output_layers()[source]#

Start from no trade without suppressing its first derivative.

forward(state)[source]#

Forward method.

Parameters:
  • data (dict) – Input data dictionary containing tensors for the model. The expected keys and tensor shapes depend on the specific model implementation.

  • training (bool, default False) – Whether the model is in training mode.

  • return_what (BaseModel.ReturnWhat, default ReturnWhat.LOSS_WEIGHT) – Specifies what the model should return. Options are: - ReturnWhat.LOSS_WEIGHT: return float loss (with gradient) and float weight (without gradient) for training. - ReturnWhat.VALUATION: return loss, weight and a dictionary of additional float metrics. - ReturnWhat.PATHWISE: return pathwise metrics as dictionary.

class quantdata.dysanos.grid.gendysanos.cell_measure_change.IndependentFeedForward(env, *, cells, num_input, num_output, config)[source]#

Bases: BaseModel

Vectorized MLPs with a disjoint parameter slice for every cell.

forward(value)[source]#

Forward method.

Parameters:
  • data (dict) – Input data dictionary containing tensors for the model. The expected keys and tensor shapes depend on the specific model implementation.

  • training (bool, default False) – Whether the model is in training mode.

  • return_what (BaseModel.ReturnWhat, default ReturnWhat.LOSS_WEIGHT) – Specifies what the model should return. Options are: - ReturnWhat.LOSS_WEIGHT: return float loss (with gradient) and float weight (without gradient) for training. - ReturnWhat.VALUATION: return loss, weight and a dictionary of additional float metrics. - ReturnWhat.PATHWISE: return pathwise metrics as dictionary.

quantdata.dysanos.grid.gendysanos.cell_measure_change.cell_pnl(action, returns, costs)[source]#

Return net P&L separately for every path, trading time, and expiry.

quantdata.dysanos.grid.gendysanos.cell_measure_change.cell_utility_and_marginal(pnl, *, utility, risk_aversion, weight)[source]#

Return the weighted objective by cell and the pathwise marginal utility.