quantdata.dysanos.grid.rndysanos.local_arbitrage#

Exact local-support masks for cost-adjusted option directions.

For direction d equal to +1 (long) or -1 (short), the empirical candidate function is

arb_d(z, omega) = 1

when every one of the k nearest training observations has d * dH_omega - c_omega >= -e_omega and at least one has a gain strictly above e_omega. The tolerance e only absorbs floating-point error; the economic cost c is subtracted explicitly.

class quantdata.dysanos.grid.rndysanos.local_arbitrage.LocalArbitrageConfig(*, neighbors=10240, query_batch_size=2048, instrument_batch_size=10, roundoff_multiplier=32.0, state_scale_floor=1e-06)[source]#

Bases: object

Logical and batching configuration for the exact local mask.

neighbors: int = 10240#
query_batch_size: int = 2048#
instrument_batch_size: int = 10#
roundoff_multiplier: float = 32.0#
state_scale_floor: float = 1e-06#
class quantdata.dysanos.grid.rndysanos.local_arbitrage.LocalArbitrageProgress(*, split, processed_states, total_states, long_only_candidate_states, short_only_candidate_states, both_direction_candidate_states)[source]#

Bases: object

Cumulative disjoint candidate-state counts during mask valuation.

quantdata.dysanos.grid.rndysanos.local_arbitrage.cost_adjusted_direction_candidates(neighbor_returns, query_cost, neighbor_roundoff)[source]#

Return long/short candidate flags with shape (B, 2, J).

quantdata.dysanos.grid.rndysanos.local_arbitrage.pack_direction_mask(mask)[source]#

Pack the option axis of a bool (..., 2, J) candidate mask.

quantdata.dysanos.grid.rndysanos.local_arbitrage.unpack_direction_mask(packed, *, instruments)[source]#

Unpack a uint8 (..., 2, ceil(J/8)) mask on its Torch device.

quantdata.dysanos.grid.rndysanos.local_arbitrage.valuate_local_arbitrage_mask(*, reference_state, reference_returns, reference_roundoff, query_state, query_returns, query_cost, query_roundoff, config, split, leave_one_out, candidate_sink=None, progress=None, progress_interval_seconds=30.0)[source]#

Evaluate the training-fitted exact kNN arb(z; omega) function.