{
  "key": "f-vol-size",
  "mech": "Scale every new order by min(1, v0 / EWMA[(rival midpoint one-step change)^2])**g.",
  "approach": "Blind subclass overlay on hash-verified N. Rival midpoint is in ticks; EWMA alpha=0.05, initialized at v0 on step 0. Missing quotes leave the estimate unchanged. Resize new PlaceOrders only; drop scaled sizes below 0.01 shares. Prices, IDs and cancellation actions are preserved. All four spreads are eligible. Freeze the sole failure-free tuning variant (v0=0.25, g=0.5), then screen on the disjoint 500-seed holdout. Screen only; no promotion.",
  "tried": {
    "incumbent_code_sha256": "bf0d179f3e47d28819f6fa7e0d25548c2ced43374c216d36460b00a26a26ffae",
    "variant_count": 3,
    "tuning_seeds": "320000..320199 inclusive",
    "selection_rule": "Require zero tuning simulation failures, then maximize paired mean total edge among eligible variants. Only v025g05 eligible.",
    "scoreboard": [
      {
        "code_sha256": "bf0d179f3e47d28819f6fa7e0d25548c2ced43374c216d36460b00a26a26ffae",
        "role": "incumbent N",
        "mean_diff": 0.0
      },
      {
        "variant": "v025g05",
        "mean_diff": -11.5659875839595,
        "se": 1.5508213136305924,
        "valid_pairs": 200,
        "failures": 0
      },
      {
        "variant": "v1g1",
        "mean_diff": -2.8601644372738693,
        "se": 0.9715500417294484,
        "valid_pairs": 199,
        "failures": 1
      },
      {
        "variant": "v4g1",
        "mean_diff": -1.8669487519487447,
        "se": 0.847501098222996,
        "valid_pairs": 199,
        "failures": 1
      }
    ],
    "local_checks": [
      "Required four baseline edges matched to six decimals.",
      "Disabled overlay equaled N actions on every callback, seeds 310000..310009 (2000 steps each).",
      "Synthetic overlay checks: EWMA arithmetic, scaling, minimum-size dropping, unchanged metadata and disabled path.",
      "Pinned simulator files used without modification; serial in-process runs, default configs, 2000 steps; no workers or sandbox."
    ]
  },
  "next": "Reject this overlay and retain N: seven holdout collateral failures and a negative paired result among the 493 valid pairs. Any repair requires a new experiment with new tuning/holdout seeds; do not promote or infer spread-specific benefits from this holdout.",
  "spreads_acted": [
    1,
    2,
    3,
    4
  ],
  "off_equals_n": {
    "passed": true,
    "seeds": "310000..310009 inclusive",
    "n": 10,
    "steps_per_seed": 2000,
    "callbacks_compared": 20000,
    "comparison": "Exact returned-action sequence equality against an independent N instance on each identical StepState; disabled branch returns N actions before sizing."
  },
  "code": "from dataclasses import replace as _vol_replace\nfrom orderbook_pm_challenge.types import PlaceOrder as _VolPlaceOrder\n\nclass Strategy(_N):\n    # Midpoints and variance are in ticks and ticks squared, respectively.\n    VOL_V0 = 0.25\n    VOL_G = 0.5\n    VOL_ALPHA = 0.05\n    VOL_ENABLED = True\n    VOL_SPREADS = (1, 2, 3, 4)\n\n    def on_step(self, state):\n        actions = super().on_step(state)\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if state.step == 0 or not hasattr(self, '_vol_prev_mid'):\n            self._vol_prev_mid = None\n            self._vol_ewma = self.VOL_V0\n        if bid is not None and ask is not None:\n            mid = (bid + ask) / 2.0\n            if self._vol_prev_mid is not None:\n                change = mid - self._vol_prev_mid\n                self._vol_ewma = ((1.0 - self.VOL_ALPHA) * self._vol_ewma\n                                  + self.VOL_ALPHA * change * change)\n            self._vol_prev_mid = mid\n        if not self.VOL_ENABLED or self.s not in self.VOL_SPREADS:\n            return actions\n        factor = min(1.0, self.VOL_V0 / max(self._vol_ewma, 1e-30)) ** self.VOL_G\n        if factor == 1.0:\n            return actions\n        return [_vol_replace(a, quantity=a.quantity * factor)\n                if isinstance(a, _VolPlaceOrder) else a for a in actions\n                if not isinstance(a, _VolPlaceOrder) or a.quantity * factor >= 0.01]\n",
  "code_sha256": "e0a27f75a26b4e6d978764b48b198db972ed2820eb3a75fe5d04b6f90803328f",
  "assembled_sha256": "4e8343c129f3dcfadc401d6ce25bc4b4273e9e31a15add31ce1e09a8dd1e621e",
  "tuning": {
    "seeds": "320000..320199 inclusive",
    "selected": "v025g05",
    "variants": [
      {
        "id": "v025g05",
        "v0": 0.25,
        "g": 0.5,
        "alpha": 0.05,
        "spreads_acted": [
          1,
          2,
          3,
          4
        ],
        "attempted_n": 200,
        "failed_seeds": [],
        "overall": {
          "n": 200,
          "sum_d": -2313.1975167919,
          "sum_d2": 122475.27428153552,
          "mean_diff": -11.5659875839595,
          "se": 1.5508213136305924,
          "incumbent_mean": 98.47071831456549,
          "candidate_mean": 86.904730730606,
          "retail_diff": -5.0531115506769995,
          "arb_diff": -6.512876033327
        },
        "by_spread": {
          "1": {
            "n": 50,
            "sum_d": -1.9050312396999902,
            "sum_d2": 557.5941451535247,
            "mean_diff": -0.0381006247939998,
            "se": 0.47703230638598754,
            "incumbent_mean": 25.711261479664,
            "candidate_mean": 25.67316085487,
            "retail_diff": -0.7769299172440002,
            "arb_diff": 0.7388292924599997
          },
          "2": {
            "n": 50,
            "sum_d": -430.5078493553,
            "sum_d2": 16255.549036024779,
            "mean_diff": -8.610156987106,
            "se": 2.2631753806610555,
            "incumbent_mean": 61.219908510538,
            "candidate_mean": 52.609751523431996,
            "retail_diff": -7.3837205762039995,
            "arb_diff": -1.2264364108699999
          },
          "3": {
            "n": 48,
            "sum_d": -704.9151743128001,
            "sum_d2": 20823.06481193667,
            "mean_diff": -14.685732798183336,
            "se": 2.1543775446456115,
            "incumbent_mean": 130.8342429047854,
            "candidate_mean": 116.14851010660209,
            "retail_diff": -7.725618557949997,
            "arb_diff": -6.960114240320833
          },
          "4": {
            "n": 52,
            "sum_d": -1175.8694618841,
            "sum_d2": 84839.06628842054,
            "mean_diff": -22.612874267001924,
            "se": 4.6866067471652375,
            "incumbent_mean": 174.37579815333268,
            "candidate_mean": 151.76292388633075,
            "retail_diff": -4.456924897719232,
            "arb_diff": -18.15594936941346
          }
        }
      },
      {
        "id": "v1g1",
        "v0": 1.0,
        "g": 1.0,
        "alpha": 0.05,
        "spreads_acted": [
          1,
          2,
          3,
          4
        ],
        "attempted_n": 200,
        "failed_seeds": [
          320151
        ],
        "overall": {
          "n": 199,
          "sum_d": -569.1727230175,
          "sum_d2": 38819.849053237165,
          "mean_diff": -2.8601644372738693,
          "se": 0.9715500417294484,
          "incumbent_mean": 98.94342463682965,
          "candidate_mean": 96.08326019955578,
          "retail_diff": -0.7553214057763827,
          "arb_diff": -2.1048430314829147
        },
        "by_spread": {
          "1": {
            "n": 49,
            "sum_d": 10.205183392199997,
            "sum_d2": 340.77890640640743,
            "mean_diff": 0.2082690488204081,
            "se": 0.3794539816910686,
            "incumbent_mean": 26.146141097942856,
            "candidate_mean": 26.354410146763268,
            "retail_diff": -0.5687572238775517,
            "arb_diff": 0.7770262727346937
          },
          "2": {
            "n": 50,
            "sum_d": -40.02888437659995,
            "sum_d2": 1214.4939280826907,
            "mean_diff": -0.800577687531999,
            "se": 0.6947170019611382,
            "incumbent_mean": 61.219908510538,
            "candidate_mean": 60.419330823006,
            "retail_diff": -1.0938221428980015,
            "arb_diff": 0.29324445539800015
          },
          "3": {
            "n": 48,
            "sum_d": -118.36620632249992,
            "sum_d2": 940.4934587006654,
            "mean_diff": -2.465962631718748,
            "se": 0.5361930825201824,
            "incumbent_mean": 130.8342429047854,
            "candidate_mean": 128.3682802730667,
            "retail_diff": -2.071471290266667,
            "arb_diff": -0.39449134147708337
          },
          "4": {
            "n": 52,
            "sum_d": -420.9828157106001,
            "sum_d2": 36324.08276004741,
            "mean_diff": -8.095823379050001,
            "se": 3.523027043172219,
            "incumbent_mean": 174.37579815333268,
            "candidate_mean": 166.2799747742827,
            "retail_diff": 0.6092667941961527,
            "arb_diff": -8.705090173232692
          }
        }
      },
      {
        "id": "v4g1",
        "v0": 4.0,
        "g": 1.0,
        "alpha": 0.05,
        "spreads_acted": [
          1,
          2,
          3,
          4
        ],
        "attempted_n": 200,
        "failed_seeds": [
          320049
        ],
        "overall": {
          "n": 199,
          "sum_d": -371.52280163780017,
          "sum_d2": 28994.420139735033,
          "mean_diff": -1.8669487519487447,
          "se": 0.847501098222996,
          "incumbent_mean": 98.99659428450603,
          "candidate_mean": 97.12964553255728,
          "retail_diff": -0.524719902795478,
          "arb_diff": -1.3422288491396983
        },
        "by_spread": {
          "1": {
            "n": 50,
            "sum_d": 8.182501681099945,
            "sum_d2": 253.82543617520756,
            "mean_diff": 0.1636500336219989,
            "se": 0.321022835668121,
            "incumbent_mean": 25.711261479664,
            "candidate_mean": 25.874911513286,
            "retail_diff": -0.2234240740380019,
            "arb_diff": 0.387074107686
          },
          "2": {
            "n": 49,
            "sum_d": -76.2217210385,
            "sum_d2": 1633.4412291215892,
            "mean_diff": -1.5555453273163264,
            "se": 0.8025456116692584,
            "incumbent_mean": 62.595388270010204,
            "candidate_mean": 61.03984294269388,
            "retail_diff": -1.0712650970204103,
            "arb_diff": -0.48428023028163236
          },
          "3": {
            "n": 48,
            "sum_d": -36.9625491156001,
            "sum_d2": 152.03707180144863,
            "mean_diff": -0.770053106575002,
            "se": 0.23404205881875445,
            "incumbent_mean": 130.8342429047854,
            "candidate_mean": 130.0641897982104,
            "retail_diff": -0.7262997802937488,
            "arb_diff": -0.043753326275000226
          },
          "4": {
            "n": 52,
            "sum_d": -266.52103316480003,
            "sum_d2": 26955.116402636788,
            "mean_diff": -5.125404483938462,
            "se": 3.1062803302773117,
            "incumbent_mean": 174.37579815333268,
            "candidate_mean": 169.25039366939424,
            "retail_diff": -0.11333995665961484,
            "arb_diff": -5.0120645272711535
          }
        }
      }
    ]
  },
  "paired": {
    "seeds": "430000..430499 inclusive",
    "n": 493,
    "complete": false,
    "missing_seeds": [
      430013,
      430108,
      430152,
      430170,
      430225,
      430238,
      430345
    ],
    "attempted_n": 500,
    "all_seed_strategy_pairs_executed_once": true,
    "overall": {
      "n": 493,
      "sum_d": -6329.6137765278,
      "sum_d2": 501860.1410549091,
      "mean_diff": -12.838973177541176,
      "se": 1.316817931232726,
      "incumbent_mean": 95.37844434617749,
      "candidate_mean": 82.53947116863631,
      "retail_diff": -5.370424580787222,
      "arb_diff": -7.468548596748073
    },
    "by_spread": {
      "1": {
        "n": 128,
        "sum_d": -612.6063163285997,
        "sum_d2": 247123.72134861592,
        "mean_diff": -4.7859868463171855,
        "se": 3.8757761762071157,
        "incumbent_mean": 38.60269589501172,
        "candidate_mean": 33.816709048694534,
        "retail_diff": -1.4351095365140611,
        "arb_diff": -3.3508773097820304
      },
      "2": {
        "n": 118,
        "sum_d": -1070.1091219386,
        "sum_d2": 26743.73098421466,
        "mean_diff": -9.068721372361018,
        "se": 1.1109404681146897,
        "incumbent_mean": 77.2850495116678,
        "candidate_mean": 68.21632813930678,
        "retail_diff": -6.61355711298983,
        "arb_diff": -2.4551642593686447
      },
      "3": {
        "n": 133,
        "sum_d": -1920.0584458240999,
        "sum_d2": 65720.82691267588,
        "mean_diff": -14.436529667850374,
        "se": 1.4712604544662957,
        "incumbent_mean": 146.55140363646615,
        "candidate_mean": 132.1148739686158,
        "retail_diff": -7.621209596044363,
        "arb_diff": -6.815320071796993
      },
      "4": {
        "n": 114,
        "sum_d": -2726.8398924365,
        "sum_d2": 162271.86180940262,
        "mean_diff": -23.919648179267543,
        "se": 2.7447259406254383,
        "incumbent_mean": 118.15311808839648,
        "candidate_mean": 94.23346990912896,
        "retail_diff": -5.876356860066666,
        "arb_diff": -18.043291319212283
      }
    },
    "statistical_note": "Every one of the 500 seeds was executed for both strategies. Seven candidate simulations failed; missing_seeds lists these invalid pairs, not unattempted runs. Statistics use only 493 valid pairs and are conditional on successful completion, not a complete 500-seed estimate. No failures were imputed or retried."
  },
  "failures": [
    {
      "phase": "tuning",
      "seed": 320049,
      "strategy": "v4g1",
      "error": "Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "tuning",
      "seed": 320151,
      "strategy": "v1g1",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430013,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430108,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430152,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430170,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430225,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430238,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    },
    {
      "phase": "holdout",
      "seed": 430345,
      "strategy": "v025g05",
      "error": "orderbook_pm_challenge.market.OrderBookError: Insufficient free cash for order collateral",
      "treatment": "Excluded from paired statistics; not rerun. No score imputation."
    }
  ],
  "check_values": [
    {
      "seed": 310000,
      "total_edge": 17.1160017503
    },
    {
      "seed": 310001,
      "total_edge": 20.0171113118
    },
    {
      "seed": 310002,
      "total_edge": 2.3903113616
    },
    {
      "seed": 310003,
      "total_edge": 241.4847522404
    }
  ],
  "python_version": "3.12.3",
  "seconds_per_simulation": 0.35114139844922854,
  "timing": {
    "measured_simulations": 1813,
    "unmeasured_simulations": 1,
    "excludes": "Import/download time; one tuning failure has no retained duration."
  }
}
