quantdata.dysanos.grid.gendysanos.arb_tracing#

Orthogonal-state direction and notional tracing for conditional arbitrage.

Arb tracing separates the conditional portfolio into a bounded direction function and an external scalar notional. A direction is learned at a moderate probe notional, after which its notional is traced explicitly. A finite utility optimum identifies a risky trade; a direction whose notional can keep increasing is passed to the empirical no-loss audit.

class quantdata.dysanos.grid.gendysanos.arb_tracing.ArbTracingConfig(*, label, source_cache_uid, state_features, risk_aversion, utility, trading_times=10, expiries=7, instruments_per_expiry=21, probe_notional=2.0, raw_norm_penalty=1e-05, raw_norm_soft_limit=8.0, covariance_relative_floor=1e-10, group='', user_version='0.1', network_config=FeedForwardConfig(activation='SiLU', num_depth=2, num_width=96, use_bias=True))[source]#

Bases: object

Logical geometry and objective of one arb-tracing direction.

trading_times: int = 10#
expiries: int = 7#
instruments_per_expiry: int = 21#
probe_notional: float = 2.0#
raw_norm_penalty: float = 1e-05#
raw_norm_soft_limit: float = 8.0#
covariance_relative_floor: float = 1e-10#
group: str = ''#
user_version: str = '0.1'#
network_config: FeedForwardConfig = FeedForwardConfig(activation='SiLU', num_depth=2, num_width=96, use_bias=True)#
property filename: str#
class quantdata.dysanos.grid.gendysanos.arb_tracing.ArbTracingTrainConfig(*, batch_size=4096, valuation_batch_size=16384, epochs=20000, minimum_epochs=4000, value_update=250, checkpoint_update=2000, lr=0.0003, weight_decay=0.0, compile=True, convergence_points=12, convergence_relative_tolerance=0.0001, seed=91301)[source]#

Bases: object

Operational settings which permit checkpoint warm starts.

batch_size: int = 4096#
valuation_batch_size: int = 16384#
epochs: int = 20000#
minimum_epochs: int = 4000#
value_update: int = 250#
checkpoint_update: int = 2000#
lr: float = 0.0003#
weight_decay: float = 0.0#
compile: bool = True#
convergence_points: int = 12#
convergence_relative_tolerance: float = 0.0001#
seed: int = 91301#
class quantdata.dysanos.grid.gendysanos.arb_tracing.OrthogonalArbDirection(env, *, config, state_mean, state_whitener)[source]#

Bases: BaseModel

Independent per-time direction networks in whitened state coordinates.

zero_output_layers()[source]#

Start at no trade while preserving the local output 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.

quantdata.dysanos.grid.gendysanos.arb_tracing.fit_physical_state_whitener(state, path_weight, indices, *, relative_eigenvalue_floor=1e-10)[source]#

Fit a time-specific physical-measure orthogonal state basis.

The cached market is sampled under an importance proposal. Consequently the physical state covariance is estimated with p/q weights, using training paths only. A caller may replace these tensors with analytic Gaussian moments when they are persisted with a future universe cache.

quantdata.dysanos.grid.gendysanos.arb_tracing.traced_scale_statistics(pnl, band, slope, path_weight, component, *, utility, risk_aversion, loss_probability_epsilon, confidence_z=3.0, loss_mc_multiplier=1.0)[source]#

Measure utility, marginal scale value, losses, and finite-risk quality.

quantdata.dysanos.grid.gendysanos.arb_tracing.tracing_numerical_band(action, returns, costs, instrument_band, *, roundoff_multiplier=32.0)[source]#

Propagate instrument arithmetic bands through a traced portfolio.

quantdata.dysanos.grid.gendysanos.arb_tracing.tracing_pnl(action, returns, costs)[source]#

Return exact net P&L for each path and trading time.

quantdata.dysanos.grid.gendysanos.arb_tracing.tracing_pnl_right_derivative(base_action, direction, notional, returns, costs)[source]#

Return the right derivative of exact net P&L along one direction.

quantdata.dysanos.grid.gendysanos.arb_tracing.tracing_raw_norm_penalty(raw_l1, *, soft_limit)[source]#

Keep the direction map away from its asymptotically flat radial tail.

quantdata.dysanos.grid.gendysanos.arb_tracing.tracing_utility_objective(pnl, path_weight, *, utility, risk_aversion)[source]#

Return the physical utility objective separately by trading time.

quantdata.dysanos.grid.gendysanos.arb_tracing.weighted_quantile(values, weights, probability)[source]#

Return a linearly interpolated quantile of a finite weighted sample.