# r6-fresh merge 01 Sources: the four supplied JSON results in `.imd/reads/artifacts/`. Their supplied input hashes are recorded in Notes. Values below are copied from those results. ## rows | key | mechanism | spreads_acted | overlay_sha256 | code_sha256 | off_target_zero | complete | failures | tuning selected: mean_diff, se | paired overall: n, mean_diff, se, retail_diff, arb_diff | |---|---|---|---|---|---|---|---|---|---| | f6-rival-vanish | rival side number-to-None transition: cancel resting own orders and suppress new orders on affected side(s) | 1,2,3,4 | fbc8e398a7d0c9454880930f15ebf6eb655d53563ff795f2b88fd8a57c0c5375 | 23b4d438dc5942f0c97b85f636a5bdc1f5fef0ab5b92139ccce38c9009156820 | true | true | [] | one_callback: 0.20038196734899968, 0.23920438758100412 | 500, -0.7206544143208009, 0.4265325309958225, -0.6164349291565996, -0.10421948516299989 | | f6-rival-two-tick | rival bid/ask retreat of at least two ticks: cancel and suppress the affected side for k callbacks | 1,2,3,4 | acb67234e5c57f9a8cc1c2fcdc0d59188d413820700a8310f88de288b0ba7622 | 70491a355647cf2c9998fc7d2d0a8af1d7309491f47f33b7da636ae32fb2ff93 | true | true | [] | k=1: -0.09335243904349978, 0.10484368996911046 | 500, -0.2065883088332009, 0.17340552118143615, -0.09283532588220077, -0.11375298293999987 | | f6-retreat-both-sides | initial spread 1 or 4; one-tick bid-down or ask-up retreat; cancel all for one callback when the retreated side has no own orders | 1,4 | ed3c868bdb0e47a309cf5b522b4a8a5fec224c95e0d39713ed1a07fcadb0c60e | 399ce6f4db9ad8f12885771d988995082506c1cf73e983ce00dbd0ffba7a575d | true | true | [] | empty_retreated_side: -8.985482526750515, 1.3881670607796082 | 500, -3.893343325172, 0.4906554566701353, -2.4382392107376, -1.455104114444 | | f6-rival-mid-shift | initial spread 1 or 4; on a whole-tick rival-mid move of at least two, shift MA resting orders by that move | 1,4 | 105ade7c0a13d524f6845f68468fad05f05fb0872f92f09aa18b045aae13f0ec | 06cdd2e86b751106e8f9416dac6289809cfef7fe6ef6e461d5798bdb880f8377 | true | true | [] | big: -0.369296, 0.315251 | 500, -0.174262, 0.191522, -0.119293, -0.054969 | ## paired by_spread Each entry is `{n, sum_d, sum_d2, mean_diff, se, worst_seeds}`; worst seeds are the five lowest d values, shown as [seed,d]. | key | s=1 | s=2 | s=3 | s=4 | |---|---|---|---|---| | vanish | {n:124, sum_d:-321.46646083750016, sum_d2:44036.276385140874, mean_diff:-2.5924714583669366, se:1.6830343119459412, worst_seeds:[[450450,-143.66414265060007],[450036,-143.07002715599998],[450465,-52.50803864660003],[450356,-5.149370205100013],[450220,-3.1426308023000047]]} | {n:143, sum_d:-14.787557530000113, sum_d2:683.6726676430613, mean_diff:-0.103409493216784, se:0.1832844749283935, worst_seeds:[[450021,-18.893432770600043],[450431,-15.862130344999969],[450211,-3.720277699700002],[450215,-1.7464903751000236],[450243,-1.1811546301]]} | {n:111, sum_d:-9.790935005999959, sum_d2:674.3073769214767, mean_diff:-0.0882066216756753, se:0.23485122612603807, worst_seeds:[[450357,-23.545419891899968],[450210,-4.103727475899973],[450289,-1.7721643768999797],[450483,-1.3036052109000025],[450293,-0.6635798928000014]]} | {n:122, sum_d:-14.282253786900238, sum_d2:256.9499621613286, mean_diff:-0.11706765399098557, se:0.13150251844427485, worst_seeds:[[450405,-12.4896245825],[450440,-5.321482177000007],[450242,-3.4769862005000505],[450157,-3.261461589400028],[450474,-3.2008744311999635]]} | | two-tick | {n:124, sum_d:-23.341270103600117, sum_d2:6811.021565614736, mean_diff:-0.18823604922258158, se:0.6680402138524763, worst_seeds:[[450322,-65.2440741922],[450141,-9.8307725023],[450492,-2.5867207138999992],[450234,-1.9149540263999967],[450244,-1.2891152947999842]]} | {n:143, sum_d:-29.465265088200027, sum_d2:151.91610848435863, mean_diff:-0.2060508048125876, se:0.08474873694757078, worst_seeds:[[450249,-7.1232780102],[450349,-6.006983008900001],[450181,-4.344838598100004],[450021,-3.3710765918000334],[450424,-2.5125090523]]} | {n:111, sum_d:-35.32055637680012, sum_d2:116.99217519423202, mean_diff:-0.3182032106018029, se:0.09306548413353906, worst_seeds:[[450337,-8.892405373700058],[450336,-2.3208982733000028],[450346,-2.2167880543999985],[450412,-2.180503401800003],[450210,-1.926201891900007]]} | {n:122, sum_d:-15.167062848000178, sum_d2:443.7434720432274, mean_diff:-0.12432018727868999, se:0.1730090062424212, worst_seeds:[[450159,-8.522480524300022],[450475,-4.530358754700018],[450277,-4.3093854569999905],[450372,-3.9769007900999895],[450190,-3.694506793499997]]} | | retreat | {n:124, sum_d:-459.02859370799996, sum_d2:20059.608034401834, mean_diff:-3.701843497645161, se:1.0971781516132957, worst_seeds:[[450450,-82.63099533770003],[450322,-73.21691429949999],[450000,-58.45962231899999],[450251,-32.10293796449997],[450013,-27.917903337099993]]} | {n:143, sum_d:0, sum_d2:0, mean_diff:0, se:0, worst_seeds:[[450010,0],[450012,0],[450014,0],[450016,0],[450017,0]]} | {n:111, sum_d:0, sum_d2:0, mean_diff:0, se:0, worst_seeds:[[450002,0],[450020,0],[450022,0],[450039,0],[450049,0]]} | {n:122, sum_d:-1487.6430688780001, sum_d2:47584.77599089352, mean_diff:-12.193795646540984, se:1.41231448045702, worst_seeds:[[450019,-84.7976182552],[450238,-71.9946569366],[450295,-47.38987526049999],[450497,-44.9653696374],[450334,-40.882800493000005]]} | | mid-shift | {n:124, sum_d:-102.641433, sum_d2:3420.578543, mean_diff:-0.827753, se:0.467654, worst_seeds:[[450322,-55.184525],[450141,-9.933576],[450106,-9.446104],[450450,-8.765253],[450244,-8.016236]]} | {n:143, sum_d:0, sum_d2:0, mean_diff:0, se:0, worst_seeds:[[450010,0],[450012,0],[450014,0],[450016,0],[450017,0]]} | {n:111, sum_d:0, sum_d2:0, mean_diff:0, se:0, worst_seeds:[[450002,0],[450020,0],[450022,0],[450039,0],[450049,0]]} | {n:122, sum_d:15.510606, sum_d2:5746.400329, mean_diff:0.127136, se:0.623808, worst_seeds:[[450019,-32.396293],[450475,-15.692062],[450238,-12.820332],[450295,-3.472998],[450029,-2.960849]]} | ## top Ranking by the largest selected-tuning target-spread mean_diff/se within each row gives: vanish (s=3, about 1.396), two-tick (s=1, about -0.028), mid-shift (s=4, about -0.552). These are not promotions. ### 1. f6-rival-vanish code_sha256: `23b4d438dc5942f0c97b85f636a5bdc1f5fef0ab5b92139ccce38c9009156820` ```python _IncumbentStrategy = Strategy class Strategy(_IncumbentStrategy): def __init__(self): super().__init__() self._rv_first = True self._rv_spread = None self._rv_prev = (None, None) self._rv_until = [-1, -1] self._rv_callback = -1 def on_step(self, state): actions = super().on_step(state) from orderbook_pm_challenge.types import PlaceOrder, CancelOrder, Side self._rv_callback += 1 quotes = (state.competitor_best_bid_ticks, state.competitor_best_ask_ticks) if self._rv_first: self._rv_first = False if quotes[0] is not None and quotes[1] is not None: self._rv_spread = max(1, (quotes[1] - quotes[0] + 1) // 2) vanished = [self._rv_prev[i] is not None and quotes[i] is None for i in range(2)] self._rv_prev = quotes if self._rv_spread not in (1, 2, 3, 4): return actions if False and any(vanished): vanished = [True, True] for i in range(2): if vanished[i]: self._rv_until[i] = self._rv_callback + 1 - 1 blocked = {side for i, side in enumerate((Side.BUY, Side.SELL)) if self._rv_until[i] >= self._rv_callback} if not blocked: return actions cancel_ids = {order.order_id for order in state.own_orders if order.side in blocked} cancels = [CancelOrder(order.order_id) for order in state.own_orders if order.order_id in cancel_ids] return cancels + [action for action in actions if not (isinstance(action, PlaceOrder) and action.side in blocked) and not (isinstance(action, CancelOrder) and action.order_id in cancel_ids)] ``` ### 2. f6-rival-two-tick code_sha256: `70491a355647cf2c9998fc7d2d0a8af1d7309491f47f33b7da636ae32fb2ff93` ```python _IncumbentStrategy = Strategy class Strategy(_IncumbentStrategy): COOLDOWN = 1 def __init__(self): super().__init__() self._first_quote_seen = False self._target_spread = False self._previous_bid = None self._previous_ask = None self._buy_hold = 0 self._sell_hold = 0 def on_step(self, state): from orderbook_pm_challenge.types import CancelAll, CancelOrder, PlaceOrder, Side actions = list(super().on_step(state)) bid = state.competitor_best_bid_ticks ask = state.competitor_best_ask_ticks if not self._first_quote_seen: self._first_quote_seen = True if bid is not None and ask is not None: spread = max(1, (ask - bid + 1) // 2) self._target_spread = spread in (1, 2, 3, 4) if not self._target_spread: self._previous_bid = bid self._previous_ask = ask return actions retreat_buy = ( self._previous_bid is not None and bid is not None and self._previous_bid - bid >= 2 ) retreat_sell = ( self._previous_ask is not None and ask is not None and ask - self._previous_ask >= 2 ) if retreat_buy: self._buy_hold = self.COOLDOWN if retreat_sell: self._sell_hold = self.COOLDOWN held_sides = set() if self._buy_hold > 0: held_sides.add(Side.BUY) if self._sell_hold > 0: held_sides.add(Side.SELL) if held_sides: existing = {order.order_id: order.side for order in state.own_orders} has_cancel_all = any(isinstance(action, CancelAll) for action in actions) filtered = [] for action in actions: if isinstance(action, PlaceOrder) and action.side in held_sides: continue if ( not has_cancel_all and isinstance(action, CancelOrder) and existing.get(action.order_id) in held_sides ): continue filtered.append(action) if has_cancel_all: actions = filtered else: cancellations = [ CancelOrder(order.order_id) for order in state.own_orders if order.side in held_sides ] actions = cancellations + filtered if self._buy_hold > 0: self._buy_hold -= 1 if self._sell_hold > 0: self._sell_hold -= 1 self._previous_bid = bid self._previous_ask = ask return actions ``` ### 3. f6-rival-mid-shift code_sha256: `06cdd2e86b751106e8f9416dac6289809cfef7fe6ef6e461d5798bdb880f8377` ```python _IncumbentStrategy = Strategy class Strategy(_IncumbentStrategy): # f6-rival-mid-shift overlay: when the rival mid moves by m whole # ticks in one step, re-place own resting orders shifted by m ticks (same quantity). _F6_MODE = "big" # "all", "away" or "big" def __init__(self): super().__init__() self._f6_s = None self._f6_prev = None def on_step(self, state): from orderbook_pm_challenge.types import CancelAll as _CA, CancelOrder as _CO, PlaceOrder as _PO, Side as _Side actions = list(super().on_step(state) or []) bid = state.competitor_best_bid_ticks ask = state.competitor_best_ask_ticks if self._f6_s is None: if bid is not None and ask is not None: self._f6_s = max(1, (ask - bid + 1) // 2) else: self._f6_s = 0 prev = self._f6_prev self._f6_prev = (bid, ask) if (bid is not None and ask is not None) else None if self._f6_s not in (1, 4) or prev is None or self._f6_prev is None: return actions dsum = (bid + ask) - (prev[0] + prev[1]) m = int(dsum / 2) # whole ticks, truncated toward zero if m == 0: return actions mode = self._F6_MODE if mode == "big" and abs(m) < 2: return actions if any(isinstance(a, _CA) for a in actions): return actions cancelled = set(a.order_id for a in actions if isinstance(a, _CO)) # conservative collateral budget after the incumbent's own actions budget = float(state.free_cash) for a in actions: if isinstance(a, _PO): p = a.price_ticks / 100.0 budget -= (p if a.side == _Side.BUY else 1.0 - p) * float(a.quantity) for o in state.own_orders: if o.order_id in cancelled and o.side == _Side.BUY: budget += o.price_ticks / 100.0 * o.remaining_quantity extra = [] for o in state.own_orders: if o.order_id in cancelled: continue if mode == "away": # the side the rival moved away from: bids when it moved up, asks when down if (m > 0) != (o.side == _Side.BUY): continue q = o.remaining_quantity if q < 0.01: continue newp = o.price_ticks + m ok = 1 <= newp <= 99 if ok and o.side == _Side.BUY and newp >= ask: ok = False if ok and o.side == _Side.SELL and newp <= bid: ok = False extra.append(_CO(o.order_id)) if o.side == _Side.BUY: budget += o.price_ticks / 100.0 * q if not ok: continue np_ = newp / 100.0 need = (np_ if o.side == _Side.BUY else 1.0 - np_) * q if need + 1e-6 > budget: continue budget -= need extra.append(_PO(side=o.side, price_ticks=newp, quantity=q)) return actions + extra ``` ## notes - No promotion: every paired holdout overall mean difference is negative, so no candidate exceeds the required positive 2-se threshold. The supplied holdouts are 450000-450499; no finalist-seed evidence for reserved 900000-903999 was supplied. No promotion table has rows because there were zero promotions. - All four rows report complete=true, failures=[], and off_target_zero=true. - Check-values objects present in the supplied results report expected=actual and all matches true. - Reported base means differ in precision: overall 106.77992531608679 versus 106.779925 in some rows; per-spread base means likewise have rounding differences. This is recorded, not normalized. - The f6-rival-mid-shift result is flagged by the brief as having one source that did not hold when re-read. I treated that source-dependent claim as unverified and used only fields and code in its supplied JSON for this merge. - Input artifact hashes: vanish 3de45dc8b7ff2aad97ff677a987879cdd6583abc4528868cc9f7cba0d8790a77; two-tick 6d0f737f4369992bfcb090328ff3e2859a7c693103cfea6d5b26787c29d5b832; retreat 12dbda12edaf5e33bf943a5e17e845893f2df80fe9a69f71711892ec82fd6f87; mid-shift 9e4714fb74333dfd103581027c0300972547f7e95ec9fc64b7005cd4ebf0ae73. - Source locations: `.imd/reads/artifacts/item-f6-rival-vanish`, `.imd/reads/artifacts/item-f6-rival-two-tick`, `.imd/reads/artifacts/item-f6-retreat-both-sides`, and `.imd/reads/artifacts/item-f6-rival-mid-shift`.