{
  "what_if": "No competitor retail matching, with the original baseline competitor ladder signal replayed",
  "blocked": null,
  "python_version": "3.14.4",
  "base_mean_edge": 109.27254289017199,
  "base_unseen": {
    "mean_edge": 98.28063388702982,
    "retail_edge": 126.0190722762842,
    "arb_edge": -27.73843838925235
  },
  "diff": {
    "mean": 15.654209962010375,
    "standard_error": 0.4816910156520244,
    "simulations": 4000,
    "seed_start": 50000,
    "retail": 15.323160906893499,
    "arb": 0.3310490551177251
  },
  "by_spread": [
    {
      "spread": 1,
      "runs": 1016,
      "diff": 18.887432062729626,
      "standard_error": 1.1434272178383673
    },
    {
      "spread": 2,
      "runs": 998,
      "diff": 15.133287683067834,
      "standard_error": 0.9113268051278619
    },
    {
      "spread": 3,
      "runs": 1017,
      "diff": 16.547512201622816,
      "standard_error": 0.9387478713801712
    },
    {
      "spread": 4,
      "runs": 969,
      "diff": 11.863124721936119,
      "standard_error": 0.8002261562593375
    }
  ],
  "how": "Simulator commit b244530ee2a6247b5f930830eeca9dd950da0e7e; Python standard library only. Strategy code extracted verbatim from the supplied JSON, SHA256 baef955ec10728839f7c3357016ec9eb0550e7ec689bbd5171b1cdd5c9e37273. Working copies lived only in test/scratch/.cache/ (the explicitly permitted scratch exception), with no submitted simulator changes. First ran python3 -m orderbook_pm_challenge run base.py --simulations 600 --seed-start 1000 --json in the clone. Then invoked the same CLI main with --simulations 4000 --seed-start 50000 --json after replacing engine.PredictionMarket by an observer subclass. The observer only recorded each build_step_state competitor best-bid/ask pair and each competitor retail fill; it delegated every original matching/action method unchanged. For each unseen seed saved exactly 2000 quote pairs. For the what-if, engine.PredictionMarket was replaced by this subclass of the original class:\nclass Ghost(PredictionMarket):\n    tape = None\n    def initialize_competitor(self, p): pass\n    def refresh_competitor(self, step): self.step = step\n    def competitor_best_quotes(self): return tuple(self.tape[self.step])\nEach engine run got that same seed's baseline quote tape, unchanged sampled config, process seed, RetailFlow seed, and unchanged base strategy class. No competitor physical orders are created, so all retail matching searches only participant orders. Everything else uses the stock engine and market: process advance, full arbitrage sweep, retail arrival/side/size generation, sell quantity conversion, rounding, collateral, action validation, fills, scoring, settlement and horizon. Actual own state and fills evolve under the what-if; they are not replayed. Paired total/retail/arb differences are calculated seed by seed, with standard_error=sample_stdev(total_edge_difference)/sqrt(n). By-spread results group by the original sampled competitor spread_ticks (1-4), without resampling. Aggregation includes every seed and no failures.\n\nMinimal score reproducer (uses only stock simulator API and standard library; prints the same paired mean/SE and spread groups):\n# Run inside the pinned stock simulator clone with the verbatim base.py present.\nfrom dataclasses import asdict\nimport json, math, statistics\nfrom orderbook_pm_challenge import engine\nfrom orderbook_pm_challenge.market import PredictionMarket\nfrom orderbook_pm_challenge.runner import sample_config\nfrom orderbook_pm_challenge.config import ChallengeConfig, ParameterVariance\nfrom orderbook_pm_challenge.loader import load_strategy_factory\nclass TapeMarket(PredictionMarket):\n    latest = None\n    def __init__(self, config):\n        super().__init__(config)\n        self.tape = []\n        TapeMarket.latest = self\n    def build_step_state(self, **kwargs):\n        state = super().build_step_state(**kwargs)\n        self.tape.append((state.competitor_best_bid_ticks, state.competitor_best_ask_ticks))\n        return state\nclass GhostMarket(PredictionMarket):\n    tape = None\n    def initialize_competitor(self, starting_probability): pass\n    def refresh_competitor(self, step): self.step = step\n    def competitor_best_quotes(self): return self.tape[self.step]\nfactory = load_strategy_factory('base.py')\npairs = []\nfor seed in range(50000, 54000):\n    config = sample_config(ChallengeConfig(), ParameterVariance(), seed=seed)\n    engine.PredictionMarket = TapeMarket\n    baseline = engine.SimulationEngine(config, factory, seed=seed).run()\n    assert not baseline.failed, baseline.error\n    GhostMarket.tape = TapeMarket.latest.tape\n    engine.PredictionMarket = GhostMarket\n    counterfactual = engine.SimulationEngine(config, factory, seed=seed).run()\n    assert not counterfactual.failed, counterfactual.error\n    pairs.append((baseline, counterfactual))\ndef summary(rows):\n    d = [g.total_edge-b.total_edge for b, g in rows]\n    return dict(runs=len(d), mean=sum(d)/len(d), standard_error=statistics.stdev(d)/math.sqrt(len(d)))\nprint(json.dumps(summary(pairs)))\nfor spread in (1, 2, 3, 4):\n    print(spread, json.dumps(summary([(b,g) for b,g in pairs if b.regime.competitor_spread_ticks == spread])))\n",
  "clean": "No extra fair-value, jump, retail-rate, order-arrival or future-price information is passed to the base. Only the competitor quote fields are replayed, from the original same-seed baseline at that exact step, as required. The shadow baseline deliberately prevents removal from changing the base's competitor price signal. Its own balances, resting orders, fills, sizes and beliefs may change as causal consequences of changed retail executions. Physical competitor orders were also absent from arbitrage, but arbitrage has unlimited sweep size and therefore gives exactly the same participant fills for a fixed participant book; both fixed-book tests and the 100-seed retail-only removal control verified this. Retail buyers may now trade at worse prices after bypassing the competitor; sellers may reach cheap tick-1 inventory bids. Those monopoly execution-price and FIFO advantages are intrinsic to this what-if and cannot all be reproduced by a live strategy that must beat the competitor. The one-tick-frontability diagnostic uses true probability only in measurement, never in strategy decisions. This measures the stipulated unchanged-base counterfactual, not a proof bounding every redesigned strategy under every feedback model.",
  "realizable": "A live strategy can capture competitor flow only by quoting a better legal price, acquiring time priority before a competitor replenishment, or supplying enough inventory/collateral at an already competitive quote. It cannot simply remove an initially older competitor order at the same tick. Even against a competitor bid at tick 1, improving it requires paying tick 2, which erases the entire immediate edge when true probability is between 0.01 and 0.02. When the competitor bids at a higher tick, winning its flow costs still more relative to the base's cheap tick-1 bid; frontability totals are therefore deliberately separated from all competitor-captured flow. Larger competitive bids pay a higher price, tie up cash, and take more informed-arbitrage risk; preserving inventory bids also holds collateral and changes the inventory target. The pilot direct fill decomposition found the gain mainly in tick-1 inventory bids, motivating two real-world trials: preserve those bids and reallocate some inventory procurement to an already competitive bid. A cancel/repost control distinguishes quantity changes from actual FIFO gains. The attempt below is a real strategy evaluated against the fully unmodified market, with selection confined to seeds 4000-7999. Its measured gain, rather than the monopoly ceiling or ex-post frontable volume, is the evidence for what this implementation can capture. The full baseline snapshot diagnostic makes the price cost concrete: when an inventory bid at tick 1 waits behind a competitor bid above tick 1, the overlapped quantity has hypothetical edge 13.479021846721 per run at tick 1. Matching the competitor price forfeits 9.930115225; improving by one tick forfeits another 4.6456265000000005, leaving aggregate raw immediate edge -1.096719878279 on that same quantity. This is a repeated-snapshot diagnostic, not an executable allocation or additional ceiling; a real policy must select opportunities and value future inventory resale rather than fronting all such flow. Existing same-price base orders overlap 1.5716496470473384 raw edge per run in the local queue diagnostic, and the 500-seed tuning preservation/repost control found no realized priority gain. On the full unseen set, retaining FIFO rather than reposting the same inventory bids changes mean edge by 0.0029731102192500193, standard error 0.0019616558127204193; 3 of 4000 SimulationResult objects differ. Thus rare priority effects exist even though the 500 tuning control runs were identical. This measured FIFO contribution is separate from the inventory-retention trial versus the original base. Both tested real variants recovered less than one point in unseen mean. These trials do not demonstrate a way to turn the 15.654209962010375-point monopoly ceiling into the target gain of 4.2 points.",
  "attempt": {
    "name": "front_stock_100",
    "mechanism": "In the unchanged strategy, immediately after q1 (desired tick-1 stock bid quantity) is computed and before order management, insert: if q1 > 0 and 1 < bid_t < ask_t and ptick - bid_t > 0.25: qb = max(qb, min(q1, 100.0)). All existing risk estimation, inventory dependence, collateral allocation, quote prices and order management remain unchanged. This reallocates some cheap-stock procurement toward the competitive bid, paying a higher price to capture retail ahead of the competitor. It uses only existing public/private strategy state.",
    "diff": {
      "mean": 0.017521660387624715,
      "standard_error": 0.059655014715235634,
      "simulations": 4000,
      "seed_start": 50000,
      "retail": 0.1749829018071503,
      "arb": -0.15746124141964998
    },
    "by_spread": [
      {
        "spread": 1,
        "runs": 1016,
        "diff": -0.005174190160236223,
        "standard_error": 0.03154910239363719
      },
      {
        "spread": 2,
        "runs": 998,
        "diff": 0.0025029742538074167,
        "standard_error": 0.06931300959093878
      },
      {
        "spread": 3,
        "runs": 1017,
        "diff": 0.10751857023913464,
        "standard_error": 0.2128524132399404
      },
      {
        "spread": 4,
        "runs": 969,
        "diff": -0.03766845767306591,
        "standard_error": 0.06765237832602515
      }
    ],
    "absolute": {
      "mean_edge": 98.29815554741745,
      "retail_edge": 126.19405517809135,
      "arb_edge": -27.895899630672
    },
    "tuning": {
      "seed_start": 4000,
      "simulations": 4000,
      "pilot_seeds": [
        4000,
        4499
      ],
      "confirmation_seeds": [
        4500,
        7999
      ],
      "selection": "Highest paired mean gain within each mechanism on 500 pilot seeds; then highest paired mean gain among these two finalists across all 4000 tuning seeds. No candidate parameters selected on unseen seeds.",
      "pilot": {
        "keep_ammo_1.0": {
          "runs": 500,
          "diff": 0.09831453871539983,
          "standard_error": 0.20158419085852414,
          "retail": -0.06626770415120052,
          "arb": 0.16458224286180007
        },
        "keep_ammo_1.5": {
          "runs": 500,
          "diff": 0.11779265237400031,
          "standard_error": 0.48016950146749743,
          "retail": 0.01719225307219991,
          "arb": 0.10060039929840008
        },
        "keep_ammo_2.0": {
          "runs": 500,
          "diff": -0.3306737088133996,
          "standard_error": 0.5506128286847233,
          "retail": 0.25145843048759964,
          "arb": -0.5821321393067997
        },
        "front_stock_100": {
          "runs": 500,
          "diff": -0.0006177625043998023,
          "standard_error": 0.08473228012017785,
          "retail": 0.1948577062107997,
          "arb": -0.19547546871720003
        },
        "front_stock_400": {
          "runs": 500,
          "diff": -0.7128543934499996,
          "standard_error": 0.2305512168847179,
          "retail": 0.5983021698335999,
          "arb": -1.3111565632808002
        },
        "front_stock_1000": {
          "runs": 500,
          "diff": -2.668739026608,
          "standard_error": 0.40009004830257755,
          "retail": 0.9194852886855992,
          "arb": -3.5882243152878
        }
      },
      "finalists": {
        "keep_ammo_1.5": {
          "all_4000": {
            "runs": 4000,
            "diff": -0.07230495794572489,
            "standard_error": 0.13542046214413872,
            "retail": 0.11236990327712502,
            "arb": -0.18467486122327495
          },
          "confirm_3500": {
            "runs": 3500,
            "diff": -0.09946175941997136,
            "standard_error": 0.13876046162993272,
            "retail": 0.1259667104492572,
            "arb": -0.22542846986922851
          }
        },
        "front_stock_100": {
          "all_4000": {
            "runs": 4000,
            "diff": 0.010331912233900061,
            "standard_error": 0.03755195922487813,
            "retail": 0.15137236416227515,
            "arb": -0.14104045192657494
          },
          "confirm_3500": {
            "runs": 3500,
            "diff": 0.011896151482228614,
            "standard_error": 0.041177881693808704,
            "retail": 0.14516017244105736,
            "arb": -0.13326402095648565
          }
        }
      },
      "queue_controls": {
        "1.5": {
          "full_result_identical_count": 500,
          "diff": {
            "runs": 500,
            "diff": 0.0,
            "standard_error": 0.0,
            "retail": 0.0,
            "arb": 0.0
          }
        },
        "2.0": {
          "full_result_identical_count": 500,
          "diff": {
            "runs": 500,
            "diff": 0.0,
            "standard_error": 0.0,
            "retail": 0.0,
            "arb": 0.0
          }
        }
      }
    },
    "code": "\"\"\"Stale-quote defence with tick probes, a sub-tick belief and cheap YES stock.\n\nEvery step the arbitrageur removes any order on the wrong side of p, so tiny\ntwo-sided probes around the estimate locate p to a tick; a grid filter narrows\nthat further.  Quotes sit one tick inside the competitor and are sized by the\nmarginal rule: one more share is worth quoting while the chance a retail order\nreaches it, times its edge, exceeds the expected arbitrage loss.  Near p=0 a\nretail buy pays almost its whole notional as edge, so YES is held to cover low\nasks.  That YES is bought when it is cheap: a large bid rests at tick 1 while p\nis above it, so the arbitrageur fills it on the crossing for about 0.1 tick a\nshare instead of nearly a full tick once p is near zero, and smaller bids sit on\nwhichever tick p is within 0.15 of.  Below tick 1 the estimate of p decays with\nthe time spent there, since no probe can see it.\n\"\"\"\nimport math\nfrom orderbook_pm_challenge.strategy import BaseStrategy\nfrom orderbook_pm_challenge.types import CancelOrder, PlaceOrder, Side\n\nP = dict(lam_r=0.25, m=5.0, sig_n=1.2, lam_j=0.0019, sig_j=0.35, sig=0.02,\n         qmax=3000.0, rmin=2, kA=0.7, kL=0.15, pL=0.05,\n         ammo=1.0, ydem=0.4, W=200.0, fy=0.6, ammo_q=60.0, ammo_pmax=0.05, ammo_maxpay=0.02,\n         fb=0.9, fu=0.7, xu=0.1, sticky=1.0, min_ahead=2.0, keep_hi=1.5, keep_lo=0.7, Hu=300.0, bins=8.0, filt=1.0, uni=0.01, jumpinfo=1.0, dmin=0.0, kLb=0.08, kLf=0.08, pinf=1.0, pre=0.0, H1=100.0,\n         ydf=0.6, Wf=2000.0, g_hi=0.15, g_lo=0.15, qf=400.0, pmaxf=0.05, pre_gap=1.0,\n         ydf1=0.6, g1=5.0, f1=0.6, a1=100.0, nb1=0.0, gs=1.0, p1t=1.0, m1=1.0, zd=1.0, pfl=0.0005)\nP.update({'W': 50, 'ammo_pmax': 0.02, 'fy': 0.7, 'fu': 0.25, 'Hu': 500})\nC = {'W': 50, 'ammo_pmax': 0.02, 'fy': 0.7, 'reserve': 200, 'scar': 0.0025, 'fu': 0.25, 'Hu': 500}\nSQ2 = math.sqrt(2.0)\nSQ2PI = math.sqrt(2.0 * math.pi)\ndef cdf(x): return 0.5 * (1.0 + math.erf(x / SQ2))\ndef pdf(x): return math.exp(-0.5 * x * x) / SQ2PI\ndef inv(p):\n    p = min(max(p, 1e-9), 1 - 1e-9)\n    t = math.sqrt(-2.0 * math.log(min(p, 1 - p)))\n    x = t - (2.515517 + 0.802853 * t + 0.010328 * t * t) / (1 + 1.432788 * t + 0.189269 * t * t + 0.001308 * t ** 3)\n    x = -x if p < 0.5 else x\n    for _ in range(2):\n        d = pdf(x)\n        if d < 1e-12:\n            break\n        x -= (cdf(x) - p) / d\n    return x\ndef lpm(k):\n    return pdf(k) + k * cdf(k)\ndef fl(q):\n    return math.floor(q * 100 + 1e-9) / 100\n\nNODES = [(-2.2, .06), (-1.3, .17), (-0.6, .27), (0.6, .27), (1.3, .17), (2.2, .06)]\nPROBE = 0.01\n\n\nclass Strategy(BaseStrategy):\n    def __init__(self):\n        self.n = 0\n        self.ahead = set()     # main orders placed strictly ahead of any competitor order at their tick\n        self.res = {}          # order id -> uncovered quantity at placement\n        self.bc = None         # belief: sub-tick grid centres (ticks)\n        self.bw = None         # belief: weights\n        self.st = 0.5          # last one-step sd in ticks\n        self.pcb = self.pca = None\n        self.pb = set()\n        self.pa = set()\n        self.tb = 0\n        self.s = None          # competitor spread parameter\n\n    def _oid(self, tag):\n        self.n += 1\n        return tag + str(self.n)\n\n    def on_step(self, state):\n        H = max(1, state.steps_remaining)\n        cb = state.competitor_best_bid_ticks or 0\n        ca = state.competitor_best_ask_ticks or 100\n        if self.s is None:\n            self.s = max(1, (ca - cb + 1) // 2)\n        lo, hi = cb, ca\n        for o in state.own_orders:\n            if o.side is Side.BUY:\n                lo = max(lo, o.price_ticks)\n            else:\n                hi = min(hi, o.price_ticks)\n        if P['pinf'] > 0:\n            sb = {o.price_ticks for o in state.own_orders if o.side is Side.BUY and o.remaining_quantity <= PROBE + 1e-9}\n            sa = {o.price_ticks for o in state.own_orders if o.side is Side.SELL and o.remaining_quantity <= PROBE + 1e-9}\n            ea = self.pa - sa\n            eb = self.pb - sb\n            if sa and ea:\n                lo = max(lo, min(max(ea), hi))\n            if eb and (sb or min(eb) <= P['p1t']):\n                hi = min(hi, max(min(eb), lo))\n        if P['jumpinfo'] > 0 and self.pcb is not None:\n            if ca > self.pca + 1:\n                lo = max(lo, ca - 1)\n            if cb < self.pcb - 1:\n                hi = min(hi, cb + 1)\n        self.pcb, self.pca = cb, ca\n        if lo > hi:\n            lo, hi = hi, lo\n        # sub-tick belief over p_(t-1): predict with one-step noise, truncate to [lo, hi]\n        wid = max(hi - lo, 1e-6)\n        nb = max(2, min(48, int(round(wid * P['bins']))))\n        cs = [lo + (i + 0.5) * wid / nb for i in range(nb)]\n        if self.bc is None or P['filt'] <= 0:\n            ws = [1.0 / nb] * nb\n        else:\n            sg = max(self.st, 0.6 * wid / nb)\n            k = -0.5 / (sg * sg)\n            ws = []\n            uni = P['uni'] * sg\n            for c in cs:\n                t = uni\n                for ci, wi in zip(self.bc, self.bw):\n                    d = c - ci\n                    d2 = d * d * k\n                    if d2 > -12.5:\n                        t += wi * math.exp(d2)\n                ws.append(t)\n            tot = sum(ws)\n            ws = [w / tot for w in ws]\n        self.bc, self.bw = cs, ws\n        mean_t = sum(c * w for c, w in zip(cs, ws))\n        var_t = max(sum(c * c * w for c, w in zip(cs, ws)) - mean_t * mean_t, 0.0)\n        phat = min(max(mean_t / 100.0, 0.002), 0.998)\n        var = P['sig'] ** 2 + P['lam_j'] * P['sig_j'] ** 2\n        sd = math.sqrt(H * var)\n        self.tb = self.tb + 1 if hi <= 1 else 0\n        if self.tb > 0 and P['zd'] > 0:\n            # below the last tick there is no probe: the score keeps walking away from it\n            phat = min(phat, max(P['pfl'], cdf(inv(0.01) - P['zd'] * 0.02 * math.sqrt(self.tb) / sd)))\n        z = inv(phat)\n        Z = z * sd\n        sp = pdf(z) / sd * P['sig']\n        self.st = sp * 100.0\n        s = math.sqrt(sp * sp + var_t / 1e4 + 1e-8)\n        sd1 = math.sqrt(max(1.0, H - 1.0) * var)\n        jp = [(cdf((Z + n * P['sig_j']) / sd1), w) for n, w in NODES]\n        lj = P['lam_j']\n\n        def AB(x):\n            k = (x - phat) / s\n            a = s * lpm(k)\n            b = a - (x - phat)\n            ja = sum(w * max(0.0, x - p) for p, w in jp)\n            jb = sum(w * max(0.0, p - x) for p, w in jp)\n            return (1 - lj) * a + lj * ja, (1 - lj) * b + lj * jb\n\n        if H == 1:\n            def AB(x):\n                return (1 - phat) * x, phat * (1 - x)\n        rho = P['lam_r'] * 0.5\n        mu = math.log(P['m']) - 0.5 * P['sig_n'] ** 2\n        kA = P['kL'] if phat < P['pL'] else P['kA']\n\n        def qsize(loss, gain, px):\n            loss *= kA\n            if gain <= 0:\n                return 0.0\n            tail = loss / (rho * gain)\n            if tail >= 1.0:\n                return 0.0\n            return min(P['qmax'], math.exp(mu + P['sig_n'] * inv(1 - max(tail, 1e-6))) / px)\n\n        ptk = phat * 100\n        def qbid(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if phat * 100 - t < P['dmin']:\n                return 0.0\n            if P['nb1'] > 0 and self.s == 1 and t == 1 and ptk < 1.0:\n                return 0.0\n            if phat < P['pL']:\n                ytg = P['ydem'] * min(H, P['W']) / max(ca - 1, ptk + 1) * 100.0\n                a *= (P['kLb'] if state.yes_inventory < ytg else P['kLf']) / P['kL']\n            return qsize(a, b, max(phat, 0.05))\n\n        def qask(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if t - phat * 100 < P['dmin']:\n                return 0.0\n            if phat < C.get('scar_p', .1):\n                a = max(0.0, a - C.get('scar', 0.0) * (1 - min(1.0, state.yes_inventory / C.get('stock', 3000.0))))\n            return min(C.get('askcap', P['qmax']), qsize(b, a, t / 100.0))\n\n        bids = [o for o in state.own_orders if o.side is Side.BUY and o.remaining_quantity > PROBE + 1e-9]\n        asks = [o for o in state.own_orders if o.side is Side.SELL and o.remaining_quantity > PROBE + 1e-9]\n        sticky = P['sticky'] > 0\n        def top(orders, comp, step):\n            if sticky and sum(o.remaining_quantity for o in orders if o.price_ticks == comp and o.order_id in self.ahead) >= P['min_ahead']:\n                return comp\n            return comp + step\n        bid_t = top(bids, cb, 1)\n        ask_t = top(asks, ca, -1)\n        qb = min(C.get('bidcap', 3000.0), qbid(bid_t))\n        qa = qask(ask_t)\n\n        Y = state.yes_inventory\n        if ask_t == 1 and H > P['H1'] and P['pre'] > 0:\n            qa = qa if Y >= P['a1'] > 0 else 0.0          # let the competitor's 2-tick ask erode instead of fronting it for nothing\n        # ammunition: hold YES so that low asks are covered\n        ptick = phat * 100\n        amt = 0\n        qam = 0.0\n        if P['ammo'] > 0 and ask_t >= 2 and phat < max(P['ammo_pmax'], P['pmaxf']):\n            wealth = state.cash + Y * phat\n            x = max(ask_t, ptick + 1) / 100.0\n            capw = P['fy'] * wealth / max(phat, 0.005)\n            target = min(P['ydem'] * min(H, P['W']) / x, capw)\n            full = min(P['ydf'] * min(H, P['Wf']) / x, capw) if phat < P['pmaxf'] else 0.0\n            t = max(1, min(99, int(math.ceil(ptick + 1e-9))))\n            g = t - ptick\n            if Y < full and g <= P['g_hi'] and bid_t <= t < ask_t:\n                amt, qam = t, min(P['qf'], full - Y)     # a tick p has just crossed: nearly free\n            elif Y < target and phat < P['ammo_pmax'] and bid_t <= t < ask_t and t / 100.0 - phat < P['ammo_maxpay']:\n                amt, qam = t, min(P['ammo_q'], target - Y)\n            elif Y < full and t >= 2 and 1.0 - g <= P['g_lo']:\n                amt, qam = t - 1, min(P['qf'], full - Y)  # rest just under p: filled only on the crossing, or by retail\n\n        if P['pre'] > 0 and ca == 2 and phat < 0.01 and H > P['H1'] and Y < P['pre'] and not qam and 1.0 - ptick < P['pre_gap']:\n            amt, qam = 1, min(P['ammo_q'], P['pre'] - Y)\n        q1 = 0.0\n        if P['ydf1'] > 0 and P['m1'] < ptick < P['g1'] + 1.0 and amt != 1:\n            q1 = max(0.0, P['ydf1'] * min(H, P['Wf']) / (self.s / 100.0) - Y)\n        # Reallocate inventory procurement to a bid ahead of the competitor.\n        if q1 > 0 and 1 < bid_t < ask_t and ptick - bid_t > 0.25:\n            qb = max(qb, min(q1, 100.0))\n        # order management\n        actions = []\n        free = state.free_cash - 2.0\n        keep_ask = 0.0\n        new_b = []\n        new_a = []\n        def cancel(o):\n            nonlocal free\n            actions.append(CancelOrder(o.order_id))\n            x = o.price_ticks / 100.0\n            if o.side is Side.BUY:\n                free += x * o.remaining_quantity\n            else:\n                free += (1 - x) * min(self.res.get(o.order_id, 0.0), o.remaining_quantity)\n            self.ahead.discard(o.order_id)\n            self.res.pop(o.order_id, None)\n        for o in state.own_orders:\n            if o.remaining_quantity <= PROBE + 1e-9:\n                cancel(o)\n        kept_ids = set()\n        def manage(orders, t, q, comp):\n            kept = 0.0\n            for o in orders:\n                if not (C.get('recover', 0) and o.side is Side.SELL and t < comp and self.res.get(o.order_id, 0.0) > 1 and state.yes_inventory > C.get('recover_yes', 1) and state.free_cash < C.get('recover_cash', 200)) and o.price_ticks == t and q > 0 and kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0):\n                    kept += o.remaining_quantity\n                    kept_ids.add(o.order_id)\n                else:\n                    cancel(o)\n            return kept\n        kb = manage(bids, bid_t, qb, cb)\n        ka = manage(asks, ask_t, qa, ca)\n        add_b = (qb - kb) if (kb < qb * P['keep_lo'] and bid_t != cb) else 0.0\n        add_a = (qa - ka) if (ka < qa * P['keep_lo'] and ask_t != ca) else 0.0\n\n        budget = P['fb'] * max(free, 0.0)\n        cost = add_b * bid_t / 100.0 + qam * amt / 100.0\n        if cost > budget:\n            f = budget / cost\n            add_b *= f\n            qam *= f\n            cost = budget\n        out = []\n        q1 = min(q1, P['f1'] * max(budget - cost, 0.0) * 100.0)\n        if q1 >= 0.01:\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=1, quantity=fl(q1)))\n            free -= fl(q1) / 100.0 + 1e-6\n        if amt and qam >= 0.01:\n            q = fl(qam)\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=amt, quantity=q))\n            free -= q * amt / 100.0 + 1e-6\n        if bid_t >= 1 and add_b >= 0.01:\n            q = fl(add_b)\n            oid = self._oid('b')\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=bid_t, quantity=q, client_order_id=oid))\n            free -= q * bid_t / 100.0 + 1e-6\n            if bid_t > cb:\n                self.ahead.add(oid)\n        if ask_t <= 99 and add_a >= 0.01:\n            x = ask_t / 100.0\n            covk = sum(o.remaining_quantity - min(self.res.get(o.order_id, 0.0), o.remaining_quantity)\n                       for o in asks if o.order_id in kept_ids)\n            cov = max(0.0, Y - covk - 0.1)\n            unc = max(0.0, add_a - cov)\n            if unc > 0:\n                ub = max(0.0, free - (1 - P['fu']) * max(state.cash, 0.0)) if x >= P['xu'] else 0.0\n                if H < P['Hu'] and phat < 0.05:\n                    ub = max(0.0, free * (1 - H / P['Hu']))\n                ub = min(ub, max(0.0, free - C.get('reserve', 0.0) * min(1.0, H / C.get('release', 50.0))))\n                unc = min(unc, ub / (1 - x))\n            q = fl(min(add_a, cov + unc))\n            if q >= 0.01:\n                oid = self._oid('a')\n                out.append(PlaceOrder(side=Side.SELL, price_ticks=ask_t, quantity=q, client_order_id=oid))\n                r = max(0.0, q - cov)\n                self.res[oid] = r\n                free -= r * (1 - x) + 1e-6\n                if ask_t < ca:\n                    self.ahead.add(oid)\n\n        # probes: tiny orders that the arbitrageur removes when p crosses them\n        f = int(math.floor(ptick + 1e-9))\n        r = max(int(P['rmin']), int(math.ceil(2.0 * s * 100)))\n        self.pb = set()\n        self.pa = set()\n        if free > 1.0:\n            for t in range(f, f + r + 1):\n                if cb < t < ca and 1 <= t <= 99:\n                    out.append(PlaceOrder(side=Side.BUY, price_ticks=t, quantity=PROBE))\n                    self.pb.add(t)\n            for t in range(f + 1 - r, f + 2):\n                if cb < t < ca and 1 <= t <= 99:\n                    out.append(PlaceOrder(side=Side.SELL, price_ticks=t, quantity=PROBE))\n                    self.pa.add(t)\n        return actions + out\n",
    "code_sha256": "861bfde26a5b399f2f5bb89882d2f07a8c550a6ba71b0b755bdc61f3bca7e4df",
    "other_preselected_finalist": {
      "name": "keep_ammo_1.5",
      "selection": "Other finalist selected on tuning seeds only; reported regardless of unseen outcome, not used to change the training-selected winner.",
      "diff": {
        "mean": -0.23712727072527504,
        "standard_error": 0.14832419456795198,
        "simulations": 4000,
        "seed_start": 50000,
        "retail": 0.17202380827635003,
        "arb": -0.4091510790008249
      },
      "by_spread": [
        {
          "spread": 1,
          "runs": 1016,
          "diff": -0.6830098746505907,
          "standard_error": 0.5165565558986613
        },
        {
          "spread": 2,
          "runs": 998,
          "diff": -0.05885776539138278,
          "standard_error": 0.21258296319452877
        },
        {
          "spread": 3,
          "runs": 1017,
          "diff": -0.14259230964090425,
          "standard_error": 0.15990571846933238
        },
        {
          "spread": 4,
          "runs": 969,
          "diff": -0.052440269856243914,
          "standard_error": 0.07362359434244942
        }
      ],
      "absolute": {
        "mean_edge": 98.04350661630455,
        "retail_edge": 126.19109608456054,
        "arb_edge": -28.147589468253177
      },
      "patch_against_base": "--- base.py\n+++ keep_ammo_1.5.py\n@@ -24,6 +24,7 @@\n          ydf1=0.6, g1=5.0, f1=0.6, a1=100.0, nb1=0.0, gs=1.0, p1t=1.0, m1=1.0, zd=1.0, pfl=0.0005)\n P.update({'W': 50, 'ammo_pmax': 0.02, 'fy': 0.7, 'fu': 0.25, 'Hu': 500})\n C = {'W': 50, 'ammo_pmax': 0.02, 'fy': 0.7, 'reserve': 200, 'scar': 0.0025, 'fu': 0.25, 'Hu': 500}\n+C.update(keep_ammo=1, ammo_keep_factor=1.5)\n SQ2 = math.sqrt(2.0)\n SQ2PI = math.sqrt(2.0 * math.pi)\n def cdf(x): return 0.5 * (1.0 + math.erf(x / SQ2))\n@@ -242,9 +243,15 @@\n             if o.remaining_quantity <= PROBE + 1e-9:\n                 cancel(o)\n         kept_ids = set()\n+        kept_ammo = 0.0\n         def manage(orders, t, q, comp):\n+            nonlocal kept_ammo\n             kept = 0.0\n             for o in orders:\n+                if (C.get('keep_ammo', 0) and o.side is Side.BUY and o.price_ticks == 1 and t != 1 and q1 > 0 and kept_ammo + o.remaining_quantity <= q1 * C.get('ammo_keep_factor', 1.5)):\n+                    kept_ammo += o.remaining_quantity\n+                    kept_ids.add(o.order_id)\n+                    continue\n                 if not (C.get('recover', 0) and o.side is Side.SELL and t < comp and self.res.get(o.order_id, 0.0) > 1 and state.yes_inventory > C.get('recover_yes', 1) and state.free_cash < C.get('recover_cash', 200)) and o.price_ticks == t and q > 0 and kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0):\n                     kept += o.remaining_quantity\n                     kept_ids.add(o.order_id)\n@@ -253,6 +260,7 @@\n             return kept\n         kb = manage(bids, bid_t, qb, cb)\n         ka = manage(asks, ask_t, qa, ca)\n+        q1 = max(0.0, q1 - kept_ammo)\n         add_b = (qb - kb) if (kb < qb * P['keep_lo'] and bid_t != cb) else 0.0\n         add_a = (qa - ka) if (ka < qa * P['keep_lo'] and ask_t != ca) else 0.0\n \n",
      "base_code_sha256": "baef955ec10728839f7c3357016ec9eb0550e7ec689bbd5171b1cdd5c9e37273",
      "code_sha256": "db67394e48b3c1858a8df177e25ea76c23495697e19fa296a02deabb1a88c32d"
    },
    "queue_priority_control": {
      "name": "keep_ammo_1.5 minus same-quantity cancel/repost control",
      "diff": {
        "mean": 0.0029731102192500193,
        "standard_error": 0.0019616558127204193,
        "simulations": 4000,
        "seed_start": 50000,
        "retail": 0.00267455939660001,
        "arb": 0.00029855082262500335
      },
      "by_spread": [
        {
          "spread": 1,
          "runs": 1016,
          "diff": 0.00589832427017717,
          "standard_error": 0.00589832427017717
        },
        {
          "spread": 2,
          "runs": 998,
          "diff": 0.00591156655160328,
          "standard_error": 0.005076500934028988
        },
        {
          "spread": 3,
          "runs": 1017,
          "diff": 0.0,
          "standard_error": 0.0
        },
        {
          "spread": 4,
          "runs": 969,
          "diff": 0.0,
          "standard_error": 0.0
        }
      ],
      "full_result_identical_count": 3997,
      "code_sha256": "fd6c53fc4cbf343797f423ad40f3db5d11cca9c5062cb083a9d19c740eeb9856",
      "patch_against_keep_ammo_1_5": "--- keep_ammo_1.5.py\n+++ repost_ammo_1.5.py\n@@ -251,6 +251,8 @@\n                 if (C.get('keep_ammo', 0) and o.side is Side.BUY and o.price_ticks == 1 and t != 1 and q1 > 0 and kept_ammo + o.remaining_quantity <= q1 * C.get('ammo_keep_factor', 1.5)):\n                     kept_ammo += o.remaining_quantity\n                     kept_ids.add(o.order_id)\n+                    actions.append(CancelOrder(o.order_id))\n+                    actions.append(PlaceOrder(side=o.side, price_ticks=o.price_ticks, quantity=o.remaining_quantity, client_order_id=o.order_id))\n                     continue\n                 if not (C.get('recover', 0) and o.side is Side.SELL and t < comp and self.res.get(o.order_id, 0.0) > 1 and state.yes_inventory > C.get('recover_yes', 1) and state.free_cash < C.get('recover_cash', 200)) and o.price_ticks == t and q > 0 and kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0):\n                     kept += o.remaining_quantity\n",
      "control_change": "At each preserved tick-1 bid, append CancelOrder(o.order_id), then PlaceOrder(side=o.side, price_ticks=o.price_ticks, quantity=o.remaining_quantity, client_order_id=o.order_id), before continuing the same preservation branch. This loses the old FIFO sequence while retaining identical initial quantities, IDs, collateral and decision logic."
    }
  },
  "tried": [
    "Unmodified CLI baseline, seeds 1000-1599, n=600: mean_edge=109.27254289017199; failures=0; exact difference from supplied baseline=0.0.",
    "Observed CLI baseline, seeds 50000-53999, n=4000: {'mean_edge': 98.28063388702982, 'retail_edge': 126.0190722762842, 'arb_edge': -27.73843838925235}; failures=0; exact difference from supplied unseen baseline=0.0.",
    "No-competitor paired result, seeds 50000-53999: {'mean': 15.654209962010375, 'standard_error': 0.4816910156520244, 'simulations': 4000, 'seed_start': 50000, 'retail': 15.323160906893499, 'arb': 0.3310490551177251}; what-if absolute means={'mean_edge': 113.9348438490402, 'retail_edge': 141.3422331831777, 'arb_edge': -27.407389334134628}; failures=0.",
    "Independent stock-engine rerun: all 20 full SimulationResult objects exactly match the observed baseline, seeds 50000-50019.",
    "Read-only observer validation: identical states, book orders, cash and fills across 30 synthetic steps; 100 fixed-book randomized cases produced identical participant arbitrage fills with and without competitor orders.",
    "PASS: removing competitor only from retail matching equals removing all physical competitor orders on 100 full 2000-step seeds",
    "Minimal embedded score reproducer smoke-tested on seeds 50000-50019: paired mean=6.375049461884994 and standard_error=2.5711778826380898, exactly matching the independent 20-seed pilot.",
    "Parallel CLI with --workers 4 failed with PermissionError: [Errno 1] Operation not permitted in multiprocessing forkserver Unix-socket creation; all reported runs use serial Python without sandbox.",
    "Zone diagnostics below use baseline seeds 50000-53999 and post-process-step true probability at retail matching. All quantities/notionals/edges are per simulation. Notional means q*YES-price, not sell-side input notional. Captures are competitor passive fills, not retail arrivals. One-tick-frontable means a legal quote one tick better than that competitor fill retains strictly positive true edge (>1e-9); it assumes ex-post fair value and unlimited incremental collateral, not a live feasible policy. Fronted-edge is at that improved price on the same captured quantity. This is a diagnostic subset of captured flow, not an additional ceiling.",
    "Paired ceiling distribution: {\"median\": 0.0, \"minimum\": -130.10381420919998, \"maximum\": 312.73569067939997, \"positive_runs\": 1885, \"zero_runs\": 2097, \"negative_runs\": 18, \"top_40_run_contribution_to_mean\": 1.7790926159077252, \"mean_without_top_40\": 14.015270046568334}. The reported ceiling uses all 4000 runs; no trimming or outlier removal.",
    "Probability zone [0,0.01): {\"competitor_quantity\": 218.436205, \"competitor_notional\": 6.341364525, \"competitor_edge\": 5.7358688142182, \"competitor_fill_count\": 0.686, \"one_tick_frontable_quantity\": 218.436205, \"one_tick_frontable_notional_at_competitor_price\": 6.341364525, \"competitor_edge_on_frontable_quantity\": 5.7358688142182, \"edge_after_one_tick_price_improvement\": 3.5515067642181997}",
    "Probability zone [0.01,0.05): {\"competitor_quantity\": 1016.849465, \"competitor_notional\": 27.466057075000002, \"competitor_edge\": 9.492140904760827, \"competitor_fill_count\": 9.9255, \"one_tick_frontable_quantity\": 262.53562, \"one_tick_frontable_notional_at_competitor_price\": 10.605260275000001, \"competitor_edge_on_frontable_quantity\": 5.015130581406183, \"edge_after_one_tick_price_improvement\": 2.3897743814061823}",
    "Probability zone [0.05,0.1): {\"competitor_quantity\": 728.4749525, \"competitor_notional\": 52.421087050000004, \"competitor_edge\": 8.872663783286615, \"competitor_fill_count\": 11.90675, \"one_tick_frontable_quantity\": 377.574185, \"one_tick_frontable_notional_at_competitor_price\": 27.9703416, \"competitor_edge_on_frontable_quantity\": 6.801270222449935, \"edge_after_one_tick_price_improvement\": 3.025528372449934}",
    "Probability zone [0.1,0.25): {\"competitor_quantity\": 1005.7742075, \"competitor_notional\": 168.12454027500002, \"competitor_edge\": 13.95883019669798, \"competitor_fill_count\": 37.10075, \"one_tick_frontable_quantity\": 554.252415, \"one_tick_frontable_notional_at_competitor_price\": 93.5936343, \"competitor_edge_on_frontable_quantity\": 11.336650085033153, \"edge_after_one_tick_price_improvement\": 5.7941259350331515}",
    "Probability zone [0.25,0.5): {\"competitor_quantity\": 1017.88737, \"competitor_notional\": 369.79367645, \"competitor_edge\": 15.529521691916859, \"competitor_fill_count\": 80.443, \"one_tick_frontable_quantity\": 585.1299525000001, \"one_tick_frontable_notional_at_competitor_price\": 212.7308585, \"competitor_edge_on_frontable_quantity\": 13.064119957524124, \"edge_after_one_tick_price_improvement\": 7.212820432524125}",
    "Probability zone [0.5,0.75): {\"competitor_quantity\": 584.13966, \"competitor_notional\": 358.19899395, \"competitor_edge\": 8.98439608092576, \"competitor_fill_count\": 78.2815, \"one_tick_frontable_quantity\": 337.28074, \"one_tick_frontable_notional_at_competitor_price\": 206.58506292500002, \"competitor_edge_on_frontable_quantity\": 7.580909968468672, \"edge_after_one_tick_price_improvement\": 4.208102568468672}",
    "Probability zone [0.75,0.9): {\"competitor_quantity\": 210.49732999999998, \"competitor_notional\": 172.47028692499998, \"competitor_edge\": 2.9773799528342804, \"competitor_fill_count\": 37.62175, \"one_tick_frontable_quantity\": 117.65333749999999, \"one_tick_frontable_notional_at_competitor_price\": 96.2156296, \"competitor_edge_on_frontable_quantity\": 2.4401637493920862, \"edge_after_one_tick_price_improvement\": 1.2636303743920863}",
    "Probability zone [0.9,0.95): {\"competitor_quantity\": 58.161595, \"competitor_notional\": 53.721443625, \"competitor_edge\": 0.7689038285395943, \"competitor_fill_count\": 11.474, \"one_tick_frontable_quantity\": 30.7148, \"one_tick_frontable_notional_at_competitor_price\": 28.288633825, \"competitor_edge_on_frontable_quantity\": 0.6049507794576571, \"edge_after_one_tick_price_improvement\": 0.29780277945765726}",
    "Probability zone [0.95,0.99): {\"competitor_quantity\": 50.0412425, \"competitor_notional\": 48.51224355, \"competitor_edge\": 0.5808209301737942, \"competitor_fill_count\": 10.3535, \"one_tick_frontable_quantity\": 21.106465, \"one_tick_frontable_notional_at_competitor_price\": 20.28850975, \"competitor_edge_on_frontable_quantity\": 0.4073673320611263, \"edge_after_one_tick_price_improvement\": 0.19630268206112628}",
    "Probability zone [0.99,1]: {\"competitor_quantity\": 13.368602500000001, \"competitor_notional\": 12.940773799999999, \"competitor_edge\": 0.39867568845646756, \"competitor_fill_count\": 1.78325, \"one_tick_frontable_quantity\": 13.368602500000001, \"one_tick_frontable_notional_at_competitor_price\": 12.940773799999999, \"competitor_edge_on_frontable_quantity\": 0.39867568845646756, \"edge_after_one_tick_price_improvement\": 0.26498966345646746}",
    "All probability zones combined: {\"competitor_quantity\": 4903.63063, \"competitor_notional\": 1269.990467225, \"competitor_edge\": 67.29920187181038, \"competitor_fill_count\": 279.576, \"one_tick_frontable_quantity\": 2518.0523225, \"one_tick_frontable_notional_at_competitor_price\": 715.5600691, \"competitor_edge_on_frontable_quantity\": 53.3851071784676, \"edge_after_one_tick_price_improvement\": 28.2045839534676}",
    "Direct fill decomposition on 100 diagnostic unseen seeds 50000-50099 (not used for parameter selection): extra tick-1 inventory-bid retail edge=14.70714086782903 per run. This includes downstream changes in inventory and is not a standalone additive ceiling. Non-main BUY orders with remaining quantity greater than the 0.01-share probe are classified as inventory bids; this component is specifically price tick 1.",
    "Supplemental diagnostic recovery: {\"recovered_complete_records\": 3331, \"regenerated_seeds\": 669, \"discarded_malformed_lines\": 1, \"discarded_old_12_field_records\": 400, \"duplicate_identical_records\": 0, \"final_full_results_exactly_matching_baseline\": 4000}. Only complete 18-field records matching the baseline were reused; missing seeds were recomputed independently and every final result was checked exactly against the baseline.",
    "Additional full-4000 baseline diagnostics, per run: {\"tick1_competitor_buy_quantity_when_p_le_0.02\": 270.07675, \"tick1_competitor_buy_notional_when_p_le_0.02\": 2.7007675, \"tick1_competitor_buy_edge_when_p_le_0.02\": 1.5102574506679018, \"tick1_competitor_buy_quantity_when_p_gt_0.02\": 30.751085, \"tick1_competitor_buy_notional_when_p_gt_0.02\": 0.30751085, \"tick1_competitor_buy_edge_when_p_gt_0.02\": 0.4229806048358937, \"competitor_quantity_at_price_with_waiting_base_order\": 245.7619725, \"competitor_notional_at_price_with_waiting_base_order\": 2.457619725, \"competitor_edge_at_price_with_waiting_base_order\": 1.6006696030741685, \"snapshot_overlap_quantity_with_waiting_base_orders\": 242.6498725, \"snapshot_overlap_notional_with_waiting_base_orders\": 2.426498725, \"snapshot_overlap_edge_with_waiting_base_orders\": 1.5716496470473384, \"competitor_buy_quantity_above_tick1_with_base_tick1_inventory_bid\": 467.88067, \"competitor_buy_notional_above_tick1_with_base_tick1_inventory_bid\": 14.662100375, \"competitor_buy_edge_above_tick1_with_base_tick1_inventory_bid\": 3.5849575018506834, \"snapshot_overlap_quantity_with_tick1_inventory_bid\": 464.56265, \"snapshot_edge_at_tick1_on_that_quantity\": 13.479021846721, \"snapshot_price_concession_to_match_competitor_price_before_one_tick_improvement\": 9.930115225}. Same-price overlap is min(competitor fill quantity, current base quantity at that price) at each fill. Repeated snapshots can reuse a waiting order; this is a local queue diagnostic, not an achievable cumulative allocation. The p<=0.02 test uses 1e-9 tolerance. All 4000 diagnostic SimulationResult objects exactly matched the first baseline.",
    "Full-4000 direct fill attribution category=ammo, aggressor=retail: baseline edge=0.5227627716954072; no-competitor edge=15.120962085281311; difference=14.598199313585905. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Full-4000 direct fill attribution category=ammo, aggressor=arb: baseline edge=-6.704333870213747; no-competitor edge=-6.136032434378691; difference=0.568301435835056. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Full-4000 direct fill attribution category=main, aggressor=retail: baseline edge=125.4696514913721; no-competitor edge=126.19461852541622; difference=0.7249670340441128. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Full-4000 direct fill attribution category=main, aggressor=arb: baseline edge=-20.55467682211912; no-competitor edge=-20.79193619550087; difference=-0.2372593733817503. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Full-4000 direct fill attribution category=probe, aggressor=retail: baseline edge=0.026658013225993732; no-competitor edge=0.026652572488242873; difference=-5.44073775085932e-06. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Full-4000 direct fill attribution category=probe, aggressor=arb: baseline edge=-0.4794276968637651; no-competitor edge=-0.47942070419855526; difference=6.992665209815119e-06. Categories are main orders (client ID starts a/b), probes (other orders <=0.01 shares remaining), inventory/ammo (other orders >0.01 shares remaining); downstream state changes are included. Raw fill edges are summed before per-step score rounding.",
    "Tuning pilot seeds 4000-4499, keep_ammo_1.0: {\"runs\": 500, \"diff\": 0.09831453871539983, \"standard_error\": 0.20158419085852414, \"retail\": -0.06626770415120052, \"arb\": 0.16458224286180007}",
    "Tuning pilot seeds 4000-4499, keep_ammo_1.5: {\"runs\": 500, \"diff\": 0.11779265237400031, \"standard_error\": 0.48016950146749743, \"retail\": 0.01719225307219991, \"arb\": 0.10060039929840008}",
    "Tuning pilot seeds 4000-4499, keep_ammo_2.0: {\"runs\": 500, \"diff\": -0.3306737088133996, \"standard_error\": 0.5506128286847233, \"retail\": 0.25145843048759964, \"arb\": -0.5821321393067997}",
    "Tuning pilot seeds 4000-4499, front_stock_100: {\"runs\": 500, \"diff\": -0.0006177625043998023, \"standard_error\": 0.08473228012017785, \"retail\": 0.1948577062107997, \"arb\": -0.19547546871720003}",
    "Tuning pilot seeds 4000-4499, front_stock_400: {\"runs\": 500, \"diff\": -0.7128543934499996, \"standard_error\": 0.2305512168847179, \"retail\": 0.5983021698335999, \"arb\": -1.3111565632808002}",
    "Tuning pilot seeds 4000-4499, front_stock_1000: {\"runs\": 500, \"diff\": -2.668739026608, \"standard_error\": 0.40009004830257755, \"retail\": 0.9194852886855992, \"arb\": -3.5882243152878}",
    "Full tuning seeds 4000-7999 and confirmation subset 4500-7999, keep_ammo_1.5: {\"all_4000\": {\"runs\": 4000, \"diff\": -0.07230495794572489, \"standard_error\": 0.13542046214413872, \"retail\": 0.11236990327712502, \"arb\": -0.18467486122327495}, \"confirm_3500\": {\"runs\": 3500, \"diff\": -0.09946175941997136, \"standard_error\": 0.13876046162993272, \"retail\": 0.1259667104492572, \"arb\": -0.22542846986922851}}",
    "Full tuning seeds 4000-7999 and confirmation subset 4500-7999, front_stock_100: {\"all_4000\": {\"runs\": 4000, \"diff\": 0.010331912233900061, \"standard_error\": 0.03755195922487813, \"retail\": 0.15137236416227515, \"arb\": -0.14104045192657494}, \"confirm_3500\": {\"runs\": 3500, \"diff\": 0.011896151482228614, \"standard_error\": 0.041177881693808704, \"retail\": 0.14516017244105736, \"arb\": -0.13326402095648565}}",
    "Queue-specific control on tuning seeds 4000-4499, keep_ammo_1.5 versus cancel-and-repost of the same retained quantities at the same prices and IDs: {\"full_result_identical_count\": 500, \"diff\": {\"runs\": 500, \"diff\": 0.0, \"standard_error\": 0.0, \"retail\": 0.0, \"arb\": 0.0}}. The control deliberately loses old FIFO sequence while retaining identical inventory targets and order IDs. All 500 full simulation results matched exactly, showing no FIFO benefit on these tuning control seeds. The separate full unseen control reports the rare priority effects not seen in this pilot.",
    "Queue-specific control on tuning seeds 4000-4499, keep_ammo_2.0 versus cancel-and-repost of the same retained quantities at the same prices and IDs: {\"full_result_identical_count\": 500, \"diff\": {\"runs\": 500, \"diff\": 0.0, \"standard_error\": 0.0, \"retail\": 0.0, \"arb\": 0.0}}. The control deliberately loses old FIFO sequence while retaining identical inventory targets and order IDs. All 500 full simulation results matched exactly, showing no FIFO benefit on these tuning control seeds. The separate full unseen control reports the rare priority effects not seen in this pilot.",
    "Other preselected finalist unseen result (does not alter the tuning-selected winner): keep_ammo_1.5 {\"mean\": -0.23712727072527504, \"standard_error\": 0.14832419456795198, \"simulations\": 4000, \"seed_start\": 50000, \"retail\": 0.17202380827635003, \"arb\": -0.4091510790008249}",
    "Unseen FIFO-specific control, seeds 50000-53999, n=4000: {\"name\": \"keep_ammo_1.5 minus same-quantity cancel/repost control\", \"diff\": {\"mean\": 0.0029731102192500193, \"standard_error\": 0.0019616558127204193, \"simulations\": 4000, \"seed_start\": 50000, \"retail\": 0.00267455939660001, \"arb\": 0.00029855082262500335}, \"by_spread\": [{\"spread\": 1, \"runs\": 1016, \"diff\": 0.00589832427017717, \"standard_error\": 0.00589832427017717}, {\"spread\": 2, \"runs\": 998, \"diff\": 0.00591156655160328, \"standard_error\": 0.005076500934028988}, {\"spread\": 3, \"runs\": 1017, \"diff\": 0.0, \"standard_error\": 0.0}, {\"spread\": 4, \"runs\": 969, \"diff\": 0.0, \"standard_error\": 0.0}], \"full_result_identical_count\": 3997, \"code_sha256\": \"fd6c53fc4cbf343797f423ad40f3db5d11cca9c5062cb083a9d19c740eeb9856\", \"patch_against_keep_ammo_1_5\": \"--- keep_ammo_1.5.py\\n+++ repost_ammo_1.5.py\\n@@ -251,6 +251,8 @@\\n                 if (C.get('keep_ammo', 0) and o.side is Side.BUY and o.price_ticks == 1 and t != 1 and q1 > 0 and kept_ammo + o.remaining_quantity <= q1 * C.get('ammo_keep_factor', 1.5)):\\n                     kept_ammo += o.remaining_quantity\\n                     kept_ids.add(o.order_id)\\n+                    actions.append(CancelOrder(o.order_id))\\n+                    actions.append(PlaceOrder(side=o.side, price_ticks=o.price_ticks, quantity=o.remaining_quantity, client_order_id=o.order_id))\\n                     continue\\n                 if not (C.get('recover', 0) and o.side is Side.SELL and t < comp and self.res.get(o.order_id, 0.0) > 1 and state.yes_inventory > C.get('recover_yes', 1) and state.free_cash < C.get('recover_cash', 200)) and o.price_ticks == t and q > 0 and kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0):\\n                     kept += o.remaining_quantity\\n\", \"control_change\": \"At each preserved tick-1 bid, append CancelOrder(o.order_id), then PlaceOrder(side=o.side, price_ticks=o.price_ticks, quantity=o.remaining_quantity, client_order_id=o.order_id), before continuing the same preservation branch. This loses the old FIFO sequence while retaining identical initial quantities, IDs, collateral and decision logic.\"}"
  ],
  "next": "Do not build a simple retention or bid-size change from the large monopoly ceiling: the real competitive-bid trial was effectively flat and the retention trial lost edge. First estimate the future resale value and collateral savings of one additional YES in low-probability states, coupling inventory procurement to future ask fills. Use that inventory value to choose a competitive bid price and quantity under the actual tick grid, collateral budget and jump risk. Require a paired unseen gain above two points before expanding the implementation. Keep the existing base as the benchmark; the tested larger competitive-bid caps already lost on tuning seeds."
}
