{"approach":"S0 keeps one passive buy and sell quote around the visible competitor midpoint, replaces a filled side, and uses a 1.5-share size to limit adverse selection. S1 is identical except it cancels every live order at age 20 steps and reposts the missing side.","tried":[{"variant":"S0, quote_size=1.5, no age cancellation","seeds":"115000..115499","n":500,"mean_total_edge":-6.215082978401201},{"variant":"S0, quote_size=3.0, no age cancellation","seeds":"115000..115499","n":500,"mean_total_edge":-12.5886684759114},{"variant":"S1, quote_size=1.5, max_age=5","seeds":"115000..115499","n":500,"mean_total_edge":-12.5560550750352},{"variant":"S1, quote_size=1.5, max_age=20","seeds":"115000..115499","n":500,"mean_total_edge":-11.4201014826514}],"next":"Do not promote this mechanism: the frozen 20-step refresh reduced paired holdout edge. A future independent test could make cancellation conditional on a changed visible competitor quote rather than refreshing on age alone.","code":"from orderbook_pm_challenge.strategy import BaseStrategy\nfrom orderbook_pm_challenge.types import CancelOrder, PlaceOrder, Side\n\n\nclass Strategy(BaseStrategy):\n    \"\"\"Passive two-sided quote around the visible competitor midpoint.\"\"\"\n\n    quote_size = 1.5\n    improvement_ticks = 1\n    max_age = 20\n\n    def __init__(self):\n        self.estimate_ticks = None\n\n    def _estimate(self, state):\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if bid is not None and ask is not None:\n            visible = (bid + ask) // 2\n            if self.estimate_ticks is None:\n                self.estimate_ticks = visible\n            # A fill can be informed; move one tick away from the filled side.\n            if state.buy_filled_quantity:\n                self.estimate_ticks = min(self.estimate_ticks, visible - 1)\n            if state.sell_filled_quantity:\n                self.estimate_ticks = max(self.estimate_ticks, visible + 1)\n        return self.estimate_ticks if self.estimate_ticks is not None else 50\n\n    def on_step(self, state):\n        actions = []\n        if self.max_age is not None:\n            actions.extend(\n                CancelOrder(order.order_id)\n                for order in state.own_orders\n                if state.step - order.submitted_step >= self.max_age\n            )\n        cancelled = {action.order_id for action in actions}\n        active = [order for order in state.own_orders if order.order_id not in cancelled]\n        estimate = self._estimate(state)\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if bid is None:\n            bid = estimate - self.improvement_ticks\n        else:\n            bid += self.improvement_ticks\n        if ask is None:\n            ask = estimate + self.improvement_ticks\n        else:\n            ask -= self.improvement_ticks\n        bid = max(1, min(98, bid))\n        ask = max(2, min(99, ask))\n        if not any(order.side is Side.BUY for order in active):\n            actions.append(PlaceOrder(Side.BUY, bid, self.quote_size))\n        if not any(order.side is Side.SELL for order in active):\n            actions.append(PlaceOrder(Side.SELL, ask, self.quote_size))\n        return actions\n","code_sha256":"d04654fd4de41bb925564bb7a26caead3a2712a5e674af1b288fed50e858c6e8","code_s0":"from orderbook_pm_challenge.strategy import BaseStrategy\nfrom orderbook_pm_challenge.types import CancelOrder, PlaceOrder, Side\n\n\nclass Strategy(BaseStrategy):\n    \"\"\"Passive two-sided quote around the visible competitor midpoint.\"\"\"\n\n    quote_size = 1.5\n    improvement_ticks = 1\n    max_age = None\n\n    def __init__(self):\n        self.estimate_ticks = None\n\n    def _estimate(self, state):\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if bid is not None and ask is not None:\n            visible = (bid + ask) // 2\n            if self.estimate_ticks is None:\n                self.estimate_ticks = visible\n            # A fill can be informed; move one tick away from the filled side.\n            if state.buy_filled_quantity:\n                self.estimate_ticks = min(self.estimate_ticks, visible - 1)\n            if state.sell_filled_quantity:\n                self.estimate_ticks = max(self.estimate_ticks, visible + 1)\n        return self.estimate_ticks if self.estimate_ticks is not None else 50\n\n    def on_step(self, state):\n        actions = []\n        if self.max_age is not None:\n            actions.extend(\n                CancelOrder(order.order_id)\n                for order in state.own_orders\n                if state.step - order.submitted_step >= self.max_age\n            )\n        cancelled = {action.order_id for action in actions}\n        active = [order for order in state.own_orders if order.order_id not in cancelled]\n        estimate = self._estimate(state)\n        bid = state.competitor_best_bid_ticks\n        ask = state.competitor_best_ask_ticks\n        if bid is None:\n            bid = estimate - self.improvement_ticks\n        else:\n            bid += self.improvement_ticks\n        if ask is None:\n            ask = estimate + self.improvement_ticks\n        else:\n            ask -= self.improvement_ticks\n        bid = max(1, min(98, bid))\n        ask = max(2, min(99, ask))\n        if not any(order.side is Side.BUY for order in active):\n            actions.append(PlaceOrder(Side.BUY, bid, self.quote_size))\n        if not any(order.side is Side.SELL for order in active):\n            actions.append(PlaceOrder(Side.SELL, ask, self.quote_size))\n        return actions\n","tuning_score":{"seeds":"115000..115499","n":500,"s1_mean":-11.4201014826514,"s0_mean":-6.215082978401201},"paired":{"seeds":"200000..200999","n":1000,"complete":true,"mechanism_diff":-5.0503233843932005,"mechanism_se":0.19008064010686557,"mechanism_retail_diff":4.282135232951901,"mechanism_arb_diff":-9.3324586173401,"reference_diff":-111.05576062761591,"reference_se":5.833126473550443,"s1_mean":-11.3598824752336,"s0_mean":-6.3095590908404,"b_mean":99.69587815238229,"failures":[]},"graft":"Keep a max_age constant. Before the existing quote-maintenance logic, emit CancelOrder(order_id) for every own order where state.step - order.submitted_step >= max_age; then treat those ids as inactive so the normal placement logic reposts them.","seconds_per_simulation":0.27206329350161834}
