{"key": "f-jump-hazard", "approach": "Overlay on N: Gamma(4, 4/0.0019) posterior on per-step jump intensity, +1 count when competitor mid moves >=3 ticks between steps, +1 step of exposure each step. Every PlaceOrder quantity from N is multiplied by exp(-0.4*posterior_mean*steps_remaining), floored to 0.01 (dropped if <0.01). Cancels pass through unchanged. Acts only when first-step s = max(1,(ask-bid+1)//2) is 1.", "tried": "Three variants on tuning seeds 310000..310199, all with every spread acted on (the brief allows at most 2, I ran 3): C=0.15 mean diff -69.3 (se 6.6); C=0.4 -63.9 (se 7.0); C=0.03 -73.5 (se 6.6). Every spread was negative for all three. Even the near-no-op C=0.03 lost about as much as C=0.4, so the loss comes from N reacting to resized resting orders and not from the size reduction itself. Spread 1 lost least (C=0.4: -34.6 per run), so I froze C=0.4 with spread set {1}. Per-spread tuning figures for C=0.15 and C=0.4 are from the first run; raw per-seed data for those was re-generated for C=0.4 and matched. Holdout run once. On the holdout S1 had 19 failed runs (N had 0); I did not look into the cause. Their partial edge is in the diffs as reported. Holdout result: mean diff -8.65, se 2.07, so the mechanism is rejected.", "next": "Hide the resizing from N: scale own_orders remaining_quantity and the fill totals by the inverse factor in the state N sees, so N's order bookkeeping is unchanged. Or change the factor only when N places a fresh order, or add and cancel whole orders instead of resizing. Test the hazard on its own, since detection of 3-tick moves was never validated here.", "spreads_acted": [1], "off_equals_n": true, "code": "import math\nfrom dataclasses import replace as _replace\n\n_SPREADS = (1,)\n_C = 0.4\n_A0 = 4.0\n_M0 = 0.0019\n_CAP = 3\n\n\nclass Strategy:\n    def __init__(self):\n        self._n = _N()\n        self._s = None\n        self._mid = None\n        self._a = _A0\n        self._b = _A0 / _M0\n\n    def on_step(self, state):\n        acts = self._n.on_step(state)\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if self._s is None:\n            if bid is None or ask is None:\n                self._s = 0\n            else:\n                self._s = max(1, (ask - bid + 1) // 2)\n        if bid is not None and ask is not None:\n            mid = (bid + ask) / 2.0\n            if self._mid is not None:\n                if abs(mid - self._mid) >= _CAP:\n                    self._a += 1.0\n                self._b += 1.0\n            self._mid = mid\n        if self._s not in _SPREADS:\n            return acts\n        lam = self._a / self._b\n        f = math.exp(-_C * lam * state.steps_remaining)\n        if f >= 0.9999:\n            return acts\n        out = []\n        for x in acts:\n            q = getattr(x, \"quantity\", None)\n            if q is None:\n                out.append(x)\n                continue\n            nq = math.floor(q * f * 100 + 1e-9) / 100.0\n            if nq >= 0.01:\n                out.append(_replace(x, quantity=nq))\n        return out\n", "code_sha256": "e6b3070d01defa2d6e9436d6b133a0a3c834d63506429bcb8b1430a868b1b897", "assembled_sha256": "dba226eb471ed4dae1690331cdf574ca994c857e311bb858aa53a8790c297351", "tuning": {"n": 200, "mean_diff": -8.1233062950425, "se": 2.8521431429265665}, "paired": {"first_seed": 410000, "last_seed": 410499, "n": 500, "complete": true, "incumbent_mean": 104.4137531881468, "mean_diff": -8.6466422506826, "se": 2.0732668703150328, "sum_d": -4323.3211253413, "sum_d2": 1109841.8722343447, "retail_diff": -4.0670200732704, "arb_diff": -4.5796221774224, "failures": {"incumbent": 0, "s1": 19}}, "by_spread": {"1": {"runs": 115, "incumbent_mean": 28.495154459731307, "mean_diff": -37.59409674209826, "se": 8.500507094853203, "sum_d": -4323.3211253413, "sum_d2": 1109841.8722343447, "retail_diff": -17.68269597074087, "arb_diff": -19.911400771401738}, "2": {"runs": 116, "incumbent_mean": 97.76626247947758, "mean_diff": 0.0, "se": 0.0, "sum_d": 0.0, "sum_d2": 0.0, "retail_diff": 0.0, "arb_diff": 0.0}, "3": {"runs": 138, "incumbent_mean": 128.4054514027384, "mean_diff": 0.0, "se": 0.0, "sum_d": 0.0, "sum_d2": 0.0, "retail_diff": 0.0, "arb_diff": 0.0}, "4": {"runs": 131, "incumbent_mean": 151.67248160310686, "mean_diff": 0.0, "se": 0.0, "sum_d": 0.0, "sum_d2": 0.0, "retail_diff": 0.0, "arb_diff": 0.0}}, "seconds_per_simulation": 3.8221430196762087}