{
  "key": "f5-rival-shift",
  "mechanism": "Cancel vulnerable-side orders after both rival quotes shift in the same direction; suppress placements for a short cooldown.",
  "approach": "Blind RC subclass calls super first, infers spread from the first quotes, and suppresses sells after an upward rival shift or buys after a downward shift. Screen four variants: minimum quote movement exactly one tick or at least two ticks, each with one or two callbacks of suppression. Freeze the highest paired tuning mean across spreads 1-4.",
  "tried": [
    {
      "name": "m1_c1",
      "code_sha256": "1c017ac4bbc20b0d6e040e77df30253cacc0659b681642990c8d1227cc512473",
      "tuning": {
        "mean_diff": -0.4528054063595009,
        "se": 0.979639871357755,
        "n": 200
      },
      "mean_diff": -0.4528054063595009,
      "se": 0.979639871357755
    },
    {
      "name": "m1_c2",
      "code_sha256": "596d7da940753102365f6c33fefe412aac9ddaddecc7baff01b7c7d254fc73ee",
      "tuning": {
        "mean_diff": 0.1915351608525005,
        "se": 1.810455534352095,
        "n": 200
      },
      "mean_diff": 0.1915351608525005,
      "se": 1.810455534352095
    },
    {
      "name": "m2_c1",
      "code_sha256": "a1a4342b9c05c05c14e4d9ff94d246c8650e40be2116c80f73d1a23ce4edb5d7",
      "tuning": {
        "mean_diff": -0.13980684085099906,
        "se": 0.08066476895643346,
        "n": 200
      },
      "mean_diff": -0.13980684085099906,
      "se": 0.08066476895643346
    },
    {
      "name": "m2_c2",
      "code_sha256": "9a8b4f2c2b090e6b38e85a6025e9092973f8e376e09e42036ffce61dab0c8f7b",
      "tuning": {
        "mean_diff": -0.8693393933969996,
        "se": 0.45230779902397694,
        "n": 200
      },
      "mean_diff": -0.8693393933969996,
      "se": 0.45230779902397694
    }
  ],
  "next": "Retain RC: the frozen overlay had a negative holdout mean and did not establish a gain. No promotion; reserve finalist seeds for measure items.",
  "spreads_acted": [
    1,
    2,
    3,
    4
  ],
  "off_equals_rc": true,
  "code": "from orderbook_pm_challenge.types import CancelOrder, PlaceOrder, Side\n\n\nclass Strategy(_RC):\n    \"\"\"Cancel the vulnerable side after a simultaneous rival quote shift.\"\"\"\n    shift_kind = 1\n    cooldown = 2\n    enabled = True\n\n    def on_step(self, state):\n        actions = super().on_step(state)\n        if not self.enabled:\n            return actions\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if not hasattr(self, '_f5_previous'):\n            self._f5_previous = (bid, ask)\n            self._f5_spread = (max(1, (ask - bid + 1) // 2)\n                               if bid is not None and ask is not None else None)\n            self._f5_until = {Side.BUY: -1, Side.SELL: -1}\n            return actions\n        old_bid, old_ask = self._f5_previous\n        self._f5_previous = (bid, ask)\n        if self._f5_spread not in (1, 2, 3, 4):\n            return actions\n        if all(x is not None for x in (bid, ask, old_bid, old_ask)):\n            db, da = bid - old_bid, ask - old_ask\n            if db * da > 0:\n                magnitude = min(abs(db), abs(da))\n                trigger = (magnitude == 1 if self.shift_kind == 1 else magnitude >= 2)\n                if trigger:\n                    side = Side.SELL if db > 0 else Side.BUY\n                    self._f5_until[side] = state.step + self.cooldown - 1\n        blocked = {side for side, until in self._f5_until.items() if state.step <= until}\n        if not blocked:\n            return actions\n        result = [a for a in actions\n                  if not (isinstance(a, PlaceOrder) and a.side in blocked)]\n        cancelled = {a.order_id for a in result if isinstance(a, CancelOrder)}\n        extra = [CancelOrder(o.order_id) for o in state.own_orders\n                 if o.side in blocked and o.order_id not in cancelled]\n        return extra + result\n",
  "code_sha256": "596d7da940753102365f6c33fefe412aac9ddaddecc7baff01b7c7d254fc73ee",
  "assembled_sha256": "5db3b6aea5ca05226c6bd11105d32c4f87e19a311c6455b52a38a67580bdf415",
  "comparator_sha256": "3c07bdcd221ac25729c3ebc92b21ac9e2014510ecb85816c4391ed81e933291f",
  "tuning": {
    "seeds": {
      "start": 330000,
      "end_inclusive": 330199
    },
    "selected": "m1_c2",
    "selection": "Largest paired mean over all target spreads, frozen before holdout.",
    "complete": true,
    "overall": {
      "n": 200,
      "sum_d": 38.3070321705001,
      "sum_d2": 130461.75696984051,
      "mean_diff": 0.1915351608525005,
      "se": 1.810455534352095,
      "comparator_mean": 97.4672213329115,
      "candidate_mean": 97.65875649376399,
      "retail_diff": -1.4485654881269983,
      "arb_diff": 1.6401006489295002
    },
    "by_spread": {
      "1": {
        "n": 54,
        "sum_d": -200.09015730660008,
        "sum_d2": 46338.43082678886,
        "mean_diff": -3.705373283455557,
        "se": 3.9914751096844894,
        "comparator_mean": 46.182844338938885,
        "candidate_mean": 42.477471055483335,
        "retail_diff": -3.9280694497796285,
        "arb_diff": 0.22269616634814782
      },
      "2": {
        "n": 57,
        "sum_d": 255.07782090459992,
        "sum_d2": 83904.12985173271,
        "mean_diff": 4.475049489554385,
        "se": 5.091968834362411,
        "comparator_mean": 87.23571902150526,
        "candidate_mean": 91.71076851105965,
        "retail_diff": -0.3803578227228051,
        "arb_diff": 4.855407312264912
      },
      "3": {
        "n": 49,
        "sum_d": -18.221967743699853,
        "sum_d2": 112.91442563301392,
        "mean_diff": -0.37187689272856844,
        "se": 0.21243055777032563,
        "comparator_mean": 112.87398754092447,
        "candidate_mean": 112.50211064819591,
        "retail_diff": -0.47597833786326293,
        "arb_diff": 0.10410144504898092
      },
      "4": {
        "n": 40,
        "sum_d": 1.5413363162001161,
        "sum_d2": 106.281865685939,
        "mean_diff": 0.038533407905002905,
        "se": 0.26094315220495634,
        "comparator_mean": 162.4077324637125,
        "candidate_mean": 162.4462658716175,
        "retail_diff": -0.8148503221699986,
        "arb_diff": 0.8533837299150001
      }
    }
  },
  "paired": {
    "seeds": {
      "start": 440000,
      "end_inclusive": 440499
    },
    "n": 500,
    "complete": true,
    "missing_seeds": [],
    "overall": {
      "n": 500,
      "sum_d": -219.36693052680016,
      "sum_d2": 20488.967860247212,
      "mean_diff": -0.43873386105360035,
      "se": 0.2858922268444159,
      "comparator_mean": 101.4369248623788,
      "candidate_mean": 100.99819100132521,
      "retail_diff": -0.9941215586304005,
      "arb_diff": 0.5553876975736001
    },
    "by_spread": {
      "1": {
        "n": 142,
        "sum_d": 42.36381074339993,
        "sum_d2": 11738.920653314553,
        "mean_diff": 0.29833669537605584,
        "se": 0.7652907041462438,
        "comparator_mean": 28.7146791778493,
        "candidate_mean": 29.01301587322535,
        "retail_diff": -1.5246593415464798,
        "arb_diff": 1.8229960369211267
      },
      "2": {
        "n": 110,
        "sum_d": -120.7968150424001,
        "sum_d2": 5643.654316336249,
        "mean_diff": -1.098152864021819,
        "se": 0.6779624669428338,
        "comparator_mean": 88.78927784058273,
        "candidate_mean": 87.6911249765609,
        "retail_diff": -0.4628093959109091,
        "arb_diff": -0.6353434681090908
      },
      "3": {
        "n": 119,
        "sum_d": -99.27051696949985,
        "sum_d2": 836.6935030911196,
        "mean_diff": -0.8342060249537803,
        "se": 0.23170587267585635,
        "comparator_mean": 143.37780997585293,
        "candidate_mean": 142.54360395089915,
        "retail_diff": -0.8326198398966406,
        "arb_diff": -0.001586185077310894
      },
      "4": {
        "n": 129,
        "sum_d": -41.66340925830015,
        "sum_d2": 2269.6993875052917,
        "mean_diff": -0.32297216479302443,
        "se": 0.3696520521483552,
        "comparator_mean": 153.5829305298,
        "candidate_mean": 153.25995836500698,
        "retail_diff": -1.0121578164162781,
        "arb_diff": 0.6891856516294577
      }
    }
  },
  "failures": [],
  "check_values": {
    "310000": 17.5126554022,
    "310001": 20.6298693268,
    "310002": 2.3903113616,
    "310003": 248.006347259
  },
  "python_version": "3.12.3",
  "seconds_per_simulation": 1.374293258918216,
  "validation": {
    "disabled_seeds": {
      "start": 320000,
      "end_inclusive": 320002
    },
    "disabled_action_comparison": "Exact action-list equality against a separate RC instance at every callback; all 6000 callbacks passed.",
    "synthetic_tests": "Passed direction, threshold, cooldown expiry, inactive spread and disabled return-object identity.",
    "off_target": "Spreads outside 1-4 return RC actions unchanged. Default variance samples only spreads 1-4; inactive-spread equality checked synthetically.",
    "assembly": "Rename the final public class Strategy declaration in RC to class _RC, leaving earlier declarations intact, then append code verbatim with no added separator.",
    "simulator_commit": "b244530ee2a6247b5f930830eeca9dd950da0e7e",
    "steps": 2000,
    "workers": 1,
    "sandbox": false,
    "records_tuning": 1000,
    "records_holdout": 1000,
    "max_seeds_per_command": 50,
    "assembled_equivalence": {
      "seed": 320003,
      "steps": 2000,
      "equal": true
    }
  },
  "scoreboard": {
    "current_best_sha256": "3c07bdcd221ac25729c3ebc92b21ac9e2014510ecb85816c4391ed81e933291f",
    "screen_only": true,
    "selected_code_sha256": "596d7da940753102365f6c33fefe412aac9ddaddecc7baff01b7c7d254fc73ee",
    "paired_holdout_mean": -0.43873386105360035,
    "paired_holdout_se": 0.2858922268444159
  }
}
