{
  "key": "f-info-order",
  "approach": "Information-budget allocation of small persistent quote sensors. N is opaque and called once every step. An online truncated-normal probability estimate uses competitor bounds and probe fills/non-fills; every visible/new N order receives estimated economic edge and binary-sensor mutual information. Among canceled N orders and existing sensors, retain at most one per side minimizing estimated adverse-selection cost per unit of information. Preserve canceled prices, resize to the chosen probe quantity, hide added orders from N using dataclasses.replace, and leave aggregate fill signals visible. No other quote modifications. Nonselected spreads return N actions unchanged.",
  "tried": [
    {
      "incumbent_sha256": "bf0d179f3e47d28819f6fa7e0d25548c2ced43374c216d36460b00a26a26ffae",
      "seed_310000_total_edge": 17.1160017503,
      "expected_rounded_edge": 17.116002,
      "seed_check_matches": true,
      "pinned_simulator_commit": "b244530ee2a6247b5f930830eeca9dd950da0e7e",
      "simulator": "Unmodified source; default ChallengeConfig and ParameterVariance; 2000 steps; serial in-process SimulationEngine; no workers or sandbox; no finalist seeds.",
      "blind": "N handled programmatically only for requested extraction, hashing, class-name replacement and execution; its source was never inspected. No other strategies or prior results read."
    },
    {
      "variants": [
        {
          "q": 0.01,
          "spreads": [
            2
          ],
          "code_sha256": "1130b4c85a03224417cf98376771b756594630788aa930cd67a40e5bbb5824e3",
          "stats": {
            "n": 200,
            "incumbent_mean": 85.16265316504199,
            "mean_diff": 0.0034883285025000704,
            "se": 0.006929741982536279,
            "sum_d": 0.6976657005000141,
            "sum_d2": 1.913682380140399,
            "retail_diff": 0.0025417211609998257,
            "arb_diff": 0.0009466073285000509
          },
          "by_spread": {
            "1": {
              "n": 47,
              "incumbent_mean": 30.59600304578298,
              "mean_diff": -0.007553670436170237,
              "se": 0.0014289439963452116,
              "sum_d": -0.35502251050000116,
              "sum_d2": 0.007096269644160791,
              "retail_diff": 0.008959373261699892,
              "arb_diff": -0.01651304392340453
            },
            "2": {
              "n": 57,
              "incumbent_mean": 81.35713208259824,
              "mean_diff": 0.012239749131579195,
              "se": 0.024430500415675675,
              "sum_d": 0.6976657005000141,
              "sum_d2": 1.913682380140399,
              "retail_diff": 0.008918319863157283,
              "arb_diff": 0.003321429222807196
            },
            "3": {
              "n": 53,
              "incumbent_mean": 115.06691980369057,
              "mean_diff": -0.026130430318871942,
              "se": 0.011730759343772207,
              "sum_d": -1.384912806900213,
              "sum_d2": 0.4154434975362305,
              "retail_diff": -0.008540504849058952,
              "arb_diff": -0.017589925458490103
            },
            "4": {
              "n": 43,
              "incumbent_mean": 112.9910514314628,
              "mean_diff": -0.04681569577674619,
              "se": 0.019863256720389705,
              "sum_d": -2.0130749184000862,
              "sum_d2": 0.8067989383330495,
              "retail_diff": -0.058063641953487184,
              "arb_diff": 0.011247946332557579
            }
          },
          "raw_stats": {
            "n": 200,
            "incumbent_mean": 85.16265316504199,
            "mean_diff": -0.01527672267650143,
            "se": 0.008820296139165922,
            "sum_d": -3.055344535300286,
            "sum_d2": 3.14302108565384,
            "retail_diff": -0.010099742927501067,
            "arb_diff": -0.005176979778500012
          }
        },
        {
          "q": 0.1,
          "spreads": [
            1
          ],
          "code_sha256": "bf4f1420642286ae7f960cebe1a0f370108380ab93339880c852eafd2e3cbb1d",
          "stats": {
            "n": 200,
            "incumbent_mean": 85.16265316504199,
            "mean_diff": 0.04864326477299996,
            "se": 0.07000554257747216,
            "sum_d": 9.728652954599992,
            "sum_d2": 195.5241179058926,
            "retail_diff": 0.054508668606999766,
            "arb_diff": -0.005865403845000034
          },
          "by_spread": {
            "1": {
              "n": 47,
              "incumbent_mean": 30.59600304578298,
              "mean_diff": 0.206992616055319,
              "se": 0.2991742865577495,
              "sum_d": 9.728652954599992,
              "sum_d2": 195.5241179058926,
              "retail_diff": 0.23195178130638197,
              "arb_diff": -0.02495916529787249
            },
            "2": {
              "n": 57,
              "incumbent_mean": 81.35713208259824,
              "mean_diff": -0.12893325761578872,
              "se": 0.03841945160778222,
              "sum_d": -7.349195684099957,
              "sum_d2": 5.659120944208864,
              "retail_diff": 0.03542052860350591,
              "arb_diff": -0.16435378638421022
            },
            "3": {
              "n": 53,
              "incumbent_mean": 115.06691980369057,
              "mean_diff": -0.2984382765679286,
              "se": 0.05790312339120651,
              "sum_d": -15.817228658100214,
              "sum_d2": 13.96070526175256,
              "retail_diff": -0.09353804220754758,
              "arb_diff": -0.2049002343377355
            },
            "4": {
              "n": 43,
              "incumbent_mean": 112.9910514314628,
              "mean_diff": -0.1963734866279066,
              "se": 0.29363890859667585,
              "sum_d": -8.444059924999983,
              "sum_d2": 157.3783878959428,
              "retail_diff": -0.2907129848302315,
              "arb_diff": 0.09433949822558091
            }
          },
          "raw_stats": {
            "n": 200,
            "incumbent_mean": 85.16265316504199,
            "mean_diff": -0.10940915656300082,
            "se": 0.09643497813311025,
            "sum_d": -21.881831312600163,
            "sum_d2": 372.5223320077968,
            "retail_diff": -0.022687353664500923,
            "arb_diff": -0.08672180294549996
          }
        }
      ],
      "selection": "For each of the two sizes, choose spread strata with positive tuning means; if none are positive, choose the least negative stratum. Select size maximizing all-200-seed mean with zero differences in inactive strata. Freeze before holdout. Tuning only 310000..310199.",
      "chosen_probe_quantity": 0.1
    },
    {
      "off_equals_n": true,
      "off_seeds": [
        310000,
        310001,
        310002,
        310003,
        310004,
        310005,
        310006,
        310007,
        310008,
        310009
      ],
      "assembled_equals_s1": true,
      "assembly_seeds": [
        310020,
        310021,
        310022,
        310023,
        310024
      ],
      "checks": "Exact complete action traces and every SimulationResult field, 2000 steps each."
    },
    {
      "holdout_probe_metrics": {
        "probes_added": 67287,
        "probe_fills": 44137,
        "probe_nonfills": 205340,
        "retained_steps": 182294,
        "information_sum": 24776.65939219391,
        "estimated_edge_sum": 1061.7412775391572,
        "n_orders_valued": 1127676
      },
      "metric_notes": "probe_fills counts probe-step observations with any partial or complete fill; probe_nonfills counts intact survival observations. retained_steps sums retained sensors across sides. information_sum is modeled information in nats at placement, not realized information. estimated_edge_sum sums model edge of the selected candidate at its pre-resize quantity, not realized probe edge. n_orders_valued counts repeated order-step valuations.",
      "holdout_later_n_quote_changes": {
        "changed_steps": 15701,
        "quantity_delta": 541131.0,
        "price_changes": 553,
        "quantity_changes": 17814,
        "runs_with_changed_n_quotes": 99,
        "first_changed_step_min": 68,
        "mean_first_changed_step": 947.3535353535353,
        "action_counts": {
          "baseline_placements": 3903220,
          "overlay_n_placements": 3903158,
          "placement_count_delta": -62
        },
        "scope": "Paired N PlaceOrder traces in baseline versus N inside S1; excludes probe placements. Price/quantity comparisons align actions by their within-step index. Differences include fill signals, collateral, inventory and subsequent market feedback; information alone is not causally isolated."
      }
    }
  ],
  "next": "Do not promote on this experiment alone. The retained sensors did not improve this holdout; test whether explicitly using non-fill bounds to allocate N quote risk can repay the sensor cost in a separate assigned experiment.",
  "spreads_acted": [
    1
  ],
  "off_equals_n": true,
  "code": "from dataclasses import replace as _info_replace\nfrom math import erf as _info_erf, exp as _info_exp, log as _info_log, pi as _info_pi, sqrt as _info_sqrt\nfrom orderbook_pm_challenge.types import PlaceOrder as _InfoPlace, CancelOrder as _InfoCancel, CancelAll as _InfoAll, Side as _InfoSide\n\n\nclass Strategy(BaseStrategy):\n    # The incumbent is opaque. Only its public callbacks/actions are used.\n    SPREADS = (1,)\n    PROBE_QUANTITY = 0.1\n\n    def __init__(self):\n        self.n = _N()\n        self.s = None\n        self.probes = {}\n        self.serial = 0\n        self.mu = 50.0\n        self.var = 9.0\n        self.last = {}\n        self.metrics = dict(probes_added=0, probe_fills=0, probe_nonfills=0,\n                            retained_steps=0, information_sum=0.0,\n                            estimated_edge_sum=0.0, n_orders_valued=0)\n        self.last_n_actions = ()\n\n    @staticmethod\n    def _cdf(x):\n        return 0.5 * (1.0 + _info_erf(x / 1.4142135623730951))\n\n    @staticmethod\n    def _pdf(x):\n        return _info_exp(-0.5 * x * x) / _info_sqrt(2.0 * _info_pi)\n\n    def _condition(self, tick, lower, weight=1.0):\n        sd = _info_sqrt(self.var)\n        z = (tick - self.mu) / sd\n        mass = 1.0 - self._cdf(z) if lower else self._cdf(z)\n        if mass < 1e-7:\n            self.mu = (1.0 - weight) * self.mu + weight * tick\n            self.var = max(0.16, self.var * (1.0 - 0.8 * weight))\n            return\n        ratio = self._pdf(z) / mass\n        mean = self.mu + (sd * ratio if lower else -sd * ratio)\n        var = self.var * (1.0 + (z * ratio if lower else -z * ratio) - ratio * ratio)\n        self.mu += weight * (mean - self.mu)\n        self.var = max(0.16, (1.0 - weight) * self.var + weight * max(0.0, var))\n\n    def _values(self, side, tick, quantity):\n        sd = _info_sqrt(self.var)\n        z = (tick - self.mu) / sd\n        cross = self._cdf(z) if side == _InfoSide.BUY else 1.0 - self._cdf(z)\n        # Fill is an imperfect threshold sensor: retail can also remove a quote.\n        retail = 0.12\n        fill = retail + (1.0 - retail) * cross\n        def entropy(p):\n            p = min(1.0 - 1e-12, max(1e-12, p))\n            return -p * _info_log(p) - (1.0 - p) * _info_log(1.0 - p)\n        information = max(0.0, entropy(fill) - (1.0 - cross) * entropy(retail))\n        adverse = sd * self._pdf(z) + ((tick - self.mu) * cross if side == _InfoSide.BUY else (self.mu - tick) * cross)\n        signed_edge = self.mu - tick if side == _InfoSide.BUY else tick - self.mu\n        edge = quantity * (retail * signed_edge - (1.0 - retail) * adverse) / 100.0\n        cost = self.PROBE_QUANTITY * (adverse / 100.0 + 0.0001)\n        return edge, information, cost, cross\n\n    def on_step(self, state):\n        if self.s is None:\n            bid, ask = state.competitor_best_bid_ticks, state.competitor_best_ask_ticks\n            self.s = max(1, (ask - bid + 1) // 2) if bid is not None and ask is not None else 0\n            if self.s in self.SPREADS:\n                self.mu = (bid + ask) / 2.0\n                self.var = max(0.5, (ask - bid) ** 2 / 12.0)\n        if self.s not in self.SPREADS:\n            actions = self.n.on_step(state)\n            self.last_n_actions = tuple(actions)\n            return actions\n\n        live = {o.order_id: o for o in state.own_orders}\n        # Infer previous-step threshold observations using only public history.\n        for oid, old in self.last.items():\n            current = live.get(oid)\n            filled = current is None or current.remaining_quantity < old.remaining_quantity - 1e-8\n            self.metrics['probe_fills' if filled else 'probe_nonfills'] += 1\n            # No fill is a hard one-sided bound; a fill might be retail.\n            lower = old.side == _InfoSide.BUY\n            self._condition(old.price_ticks, lower if not filled else not lower,\n                            1.0 if not filled else 0.55)\n        self.var = min(100.0, self.var + 0.30 * 2000.0 / max(30, state.steps_remaining) + 0.10)\n        bid, ask = state.competitor_best_bid_ticks, state.competitor_best_ask_ticks\n        if bid is not None:\n            self._condition(bid, True)\n        if ask is not None:\n            self._condition(ask, False)\n        self.mu = min(99.9, max(0.1, self.mu))\n\n        hidden = set(self.probes)\n        visible = tuple(o for o in state.own_orders if o.order_id not in hidden)\n        actions = list(self.n.on_step(_info_replace(state, own_orders=visible)))\n        self.last_n_actions = tuple(actions)\n        canceled = set()\n        for a in actions:\n            if isinstance(a, _InfoAll):\n                canceled.update(o.order_id for o in visible)\n            elif isinstance(a, _InfoCancel):\n                canceled.add(a.order_id)\n        choices = {_InfoSide.BUY: [], _InfoSide.SELL: []}\n        for o in visible:\n            values = self._values(o.side, o.price_ticks, o.remaining_quantity)\n            self.metrics['n_orders_valued'] += 1\n            if o.order_id in canceled:\n                choices[o.side].append((o.price_ticks, values))\n        for a in actions:\n            if isinstance(a, _InfoPlace):\n                self._values(a.side, a.price_ticks, a.quantity)\n                self.metrics['n_orders_valued'] += 1\n        for oid in hidden:\n            if oid in live:\n                o = live[oid]\n                choices[o.side].append((o.price_ticks, self._values(o.side, o.price_ticks, o.remaining_quantity)))\n\n        selected = {}\n        for side, candidates in choices.items():\n            valid = [(cost / info, tick, edge, info) for tick, (edge, info, cost, cross) in candidates\n                     if info >= 0.025 and 0.01 <= cross <= 0.99]\n            if valid:\n                _, tick, edge, info = min(valid)\n                selected[side] = (tick, edge, info)\n\n        keep = set()\n        for oid in hidden:\n            if oid in live:\n                o = live[oid]\n                if o.side in selected and selected[o.side][0] == o.price_ticks:\n                    keep.add(oid)\n        # CancelAll must not remove retained sensors. Its visible-order effect is identical.\n        changed = []\n        for a in actions:\n            if isinstance(a, _InfoAll):\n                changed.extend(_InfoCancel(o.order_id) for o in visible)\n            else:\n                changed.append(a)\n        changed = [_InfoCancel(oid) for oid in hidden if oid in live and oid not in keep] + changed\n        self.probes = {oid: live[oid] for oid in keep}\n        for side, (tick, edge, info) in selected.items():\n            if any(o.side == side for o in self.probes.values()):\n                self.metrics['retained_steps'] += 1\n                continue\n            # Conservative collateral slack: never spend N's intended budget.\n            reserved_new = sum(a.quantity * (a.price_ticks / 100.0 if a.side == _InfoSide.BUY else 1.0 - a.price_ticks / 100.0)\n                               for a in actions if isinstance(a, _InfoPlace))\n            if state.free_cash - reserved_new < 1.0:\n                continue\n            self.serial += 1\n            oid = '__info_probe_%d' % self.serial\n            q = self.PROBE_QUANTITY\n            changed.append(_InfoPlace(side, tick, q, oid))\n            from orderbook_pm_challenge.types import OwnOrderView\n            self.probes[oid] = OwnOrderView(oid, side, tick, q, state.step)\n            self.metrics['probes_added'] += 1\n            self.metrics['information_sum'] += info\n            self.metrics['estimated_edge_sum'] += edge\n        self.last = dict(self.probes)\n        return changed\n",
  "code_sha256": "bf4f1420642286ae7f960cebe1a0f370108380ab93339880c852eafd2e3cbb1d",
  "assembled_sha256": "08e9c7869ef61c6d9a3a8a073b3d97056da8c59aa1c0f4c5c53775c0bb9d6621",
  "tuning": {
    "n": 200,
    "mean_diff": 0.04864326477299996,
    "se": 0.07000554257747216
  },
  "paired": {
    "n": 500,
    "incumbent_mean": 104.4137531881468,
    "mean_diff": -0.026590906622400077,
    "se": 0.007696442344119877,
    "sum_d": -13.295453311200038,
    "sum_d2": 15.132726734212786,
    "retail_diff": 0.011876189333000097,
    "arb_diff": -0.03846709596159997,
    "first_seed": 410000,
    "last_seed": 410499,
    "complete": true,
    "failures": 0
  },
  "by_spread": {
    "1": {
      "incumbent_mean": 28.495154459731307,
      "mean_diff": -0.11561263748869599,
      "se": 0.03220311717728864,
      "sum_d": -13.295453311200038,
      "sum_d2": 15.132726734212786,
      "retail_diff": 0.051635605795652594,
      "arb_diff": -0.16724824331130422,
      "runs": 115
    },
    "2": {
      "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,
      "runs": 116
    },
    "3": {
      "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,
      "runs": 138
    },
    "4": {
      "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,
      "runs": 131
    }
  },
  "seconds_per_simulation": 1.1093022384478244
}
