quantdata.dysanos.grid.gendysanos.expiry_arbitrage#
Expiry-separated conditional-arbitrage models and diagnostics.
Each expiry is an independent market containing its matched spot instrument and the 20 option strikes. No action or objective combines instruments from different expiries. Within one expiry the path P&L is
X_e = sum_t a_e(t, x_t)' R_e(t) - |a_e(t, x_t)|' c_e(t).
The helpers in this module implement three searches for the action a_e:
a generic lower bound over the complete piecewise-linear terminal-payoff cone;
maximum mean subject to a zero negative-part constraint; and
a power-exponential optimized certainty equivalent (OCE).
All searches use the same radial L1 map. An exterior quadratic penalty acts on the unconstrained output, so an output outside the unit ball retains a radial gradient back towards feasibility.
- class quantdata.dysanos.grid.gendysanos.expiry_arbitrage.ExpiryActionNetwork(env, *, config, state_mean, state_scale)[source]#
Bases:
BaseModelOne independent action network per expiry with a radial L1 budget.
- 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, defaultReturnWhat.LOSS_WEIGHT) – Specifies what the model should return. Options are: -ReturnWhat.LOSS_WEIGHT: return floatloss(with gradient) and floatweight(without gradient) for training. -ReturnWhat.VALUATION: returnloss,weightand a dictionary of additional float metrics. -ReturnWhat.PATHWISE: return pathwise metrics as dictionary.
- class quantdata.dysanos.grid.gendysanos.expiry_arbitrage.ExpiryArbitrageConfig(*, label, state_features, trading_times=10, expiries=7, instruments_per_expiry=21, group='', user_version='0.1', method='negative-part', hedge='delta', cost_rate=0.0001, lmbda=1.0, raw_norm_penalty=1.0, network_config=FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=128, use_bias=True))[source]#
Bases:
objectLogical configuration of an expiry-separated conditional policy.
- network_config: FeedForwardConfig = FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=128, use_bias=True)#
- class quantdata.dysanos.grid.gendysanos.expiry_arbitrage.ExpiryArbitrageModel(env, *, config, state_mean, state_scale)[source]#
Bases:
BaseModelExpiry-separated action model with optional OCE cash offsets.
- class quantdata.dysanos.grid.gendysanos.expiry_arbitrage.ExpiryArbitrageTrainConfig(*, batch_size=4096, valuation_batch_size=16384, epochs=30000, minimum_epochs=5000, value_update=500, checkpoint_update=2000, lr=0.0003, weight_decay=0.0, compile=True, augmented_rho=100.0, feasibility_tolerance=1e-10, convergence_points=8, convergence_relative_tolerance=0.0002, seed=82061)[source]#
Bases:
objectOperational settings which may warm-start the same logical model.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.exact_payoff_cone_lower_bound(action, *, spot, option_price, delta, cash_strike, costs, hedge)[source]#
Return time/path worst-case bounds and upper-tail slopes.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.expiry_portfolio_pnl(action, returns, costs)[source]#
Return trading-time and path P&L for expiry-separated actions.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.payoff_cone_values(action, *, spot, option_price, delta, cash_strike, costs, hedge)[source]#
Return payoff at every kink and the upper-tail portfolio slope.
Terminal spot is restricted to
[0, infinity). The P&L is piecewise linear, so its finite minimum is attained at zero or at a cash strike, provided the upper-tail slope is nonnegative. The returned scenario axis contains exactly those points. The first instrument is the matched spot; the remaining instruments are calls ordered by strike.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.payoff_cone_numerical_band(action, *, spot, option_price, delta, cash_strike, costs, hedge, roundoff_multiplier=32.0)[source]#
Propagate float32 operand error through one payoff-cone action.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.powerexp_oce_by_expiry(model, path_pnl, path_weight)[source]#
Return weighted OCE values and both first-order residuals by expiry.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.propagated_expiry_band(action, returns, costs, instrument_band, *, roundoff_multiplier=32.0)[source]#
Propagate float32 instrument bands through time and each expiry.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.smooth_payoff_cone_lower_bound(action, *, spot, option_price, delta, cash_strike, costs, hedge, temperature)[source]#
Differentiable, zero-preserving soft minimum used only during fitting.
- quantdata.dysanos.grid.gendysanos.expiry_arbitrage.solve_payoff_cone_lp(*, spot, option_price, delta, cash_strike, costs, hedge)[source]#
Solve one observable-state payoff-cone separation problem exactly.
The linear program maximizes the worst terminal P&L over all spot values in
[0,infinity)subject to an L1 action budget. Long and short notionals are separate nonnegative variables. No realized future return is used.