{"approach":"For spread 4 only, remove the special low-price bid-risk discount by setting kLb and kLf to the existing kL during initialization. Separate crossing-cover and stock orders remain available. Logging identified buying stock above the moved probability as the largest measured low-price leak; restoring the ordinary penalty reduces speculative replenishment while retaining retail asks. No new constant, seed recognition, external dependency, or changes to other spreads. Static capacity diagnostics are not claimed as causal backtest gains.","blocked":null,"spread":4,"base_mean_edge":108.63974289615767,"found":["Provenance: simulator commit b244530ee2a6247b5f930830eeca9dd950da0e7e; start code SHA256 4bbf720ff34be09b441e84a7e0c1bf47cba036b5211c4118e44a597f941453db. All measurements use unmodified engine scoring; market subclass only records observations.","Choosing: 2050 spread-4 seeds in [30000,38000); 259 rich runs have true post-move probability below 0.02 for more than 500 steps. Mean such steps=807.9073359073359. No run-count halving: scorer calibration took 84.17 seconds.","Rich-run means during those low-price steps: offered retail BUY dollars=449.0493547219894; participant ask edge retained=398.703310034005; static ask-capacity edge gap=9.008276504530185; static no-stock edge gap=0.5260888439308633; static worse-tick edge gap=0.0025772618874534757; arbitrage loss on bids filled below 2c=14.790665960201736.","Whole rich-run means, including steps above 2c: offered retail BUY dollars=1129.3614709670753; retained participant ask edge=506.5963866931555. Both additional logging passes reproduced edge, retail edge and arbitrage edge exactly on all 259 rich runs.","Capacity gaps are observational proxies, include lot-rounding dust and risk-withheld quotes, and are not independently executable gains: opportunity is offered dollars*(1-p/front_price), front_price=(current competitor ask-1)/100. The price gap is computed only on our actual sale notional. Remaining nonnegative gap is no_stock when YES<visible ask quantity+1, otherwise ask_size. Offered dollars also contain fair value; offered minus retained is not all recoverable edge.","Frozen-file confirming rich subset: {\"runs\":253,\"mean\":1.1598660634948599,\"standard_error\":0.26098514650899335,\"retail\":-0.08294068605691457,\"arb\":1.2428067495494073,\"trimmed\":1.1994754289523601,\"runs_up\":185,\"runs_down\":68,\"failures\":0}","Validation on reserved choosing seeds [34000,38000): {\"runs\":1024,\"mean\":0.6130823470129881,\"standard_error\":0.08165876754059478,\"retail\":-0.021348433571778035,\"arb\":0.6344307805859375,\"trimmed\":0.5246527426760955,\"runs_up\":419,\"runs_down\":97,\"failures\":0}. The final rule and hash were fixed before these runs; confirming seeds were not used to choose it.","Per-rich-run CSV follows: seed,low_steps,retail_buy_dollars,retained_ask_edge,ask_size_gap,worse_tick_gap,bid_arb_loss_under2c,no_stock_gap. All floats are unrounded; gaps use the static benchmark above.","30007,633,398.2928973434722,387.00596332327297,0.01302591327001245,0.0009030012132148978,40.47701271735216,0.0075097150332407055","30038,648,370.9323009530101,278.75586989598906,0.18433872350877514,0.005407897657834301,12.369871972198835,0.0","30047,670,602.9991166978963,399.0279479297905,141.78232550125153,0.0029946988451150887,8.532315907016722,0.0","30104,1090,458.59447380804335,434.4089861940701,9.49010290577712,0.0008316587725071896,17.104601522119758,0.0","30117,1000,586.6568240305922,513.709986352051,5.957398868308981,0.0038550523800187724,54.90087824609011,0.0","30215,860,544.9170804430057,514.9672158075206,1.0367085912204062,0.0010504328640875446,67.38241735290968,0.003886817622545658","30234,926,620.1983016778703,583.9904484563685,0.025650552910931552,0.0025341628839936053,27.147685809594083,0.0","30241,819,294.05932240327024,262.8296300171567,0.01695442472948986,0.0029457943983248547,3.404173831939694,0.0","30258,894,483.0359264771898,464.9619941465751,0.0172653846366783,0.0007000112792705255,12.22829498606637,0.0","30374,843,288.3246576970519,270.22238965700626,0.022388132528472778,0.0020505722708208003,9.128616272587243,0.0","30384,657,292.46700291622784,268.19804147684005,0.12688751632722575,0.0019548276465332685,1.6314252838314667,0.0","30412,1147,475.7792913355856,411.88258362114294,1.6917158453212409,0.004859722194543473,13.630705301059201,0.0","30417,506,416.447644292341,362.19202417796055,6.433395361379049,0.0016443047509557991,12.472861220622683,0.0","30507,784,281.38543168931983,255.2834707031878,4.110958801171213,0.0014502421056919533,15.22767436483058,0.0","30512,837,324.55260554996863,277.0512307738246,3.884784761608439,0.0026957593881624547,6.255408804773236,0.0","30520,1390,454.48208910457095,410.928260795979,2.7073646671500664,0.004498899298491398,9.22155180487945,0.0","30527,698,441.445879647314,378.07293501929956,27.601765498311156,0.002217277401760839,9.30808514181736,0.0","30569,711,464.7308941200799,375.0777837713172,0.006702703724515065,0.002961727926999388,14.482305515950538,0.0","30583,577,592.9079063140142,485.5345094976347,0.013300492875610586,0.002767565641274237,19.32662315128174,0.00030186255928326853","30584,1038,489.73422538190033,408.1439466518249,0.02119814373060105,0.00577874066205547,6.562177320250149,0.0","30615,658,324.6480514522753,301.6939372664561,0.8642874478679458,0.0018285759937511172,12.059085918559223,0.0","30649,579,548.8773742615555,285.7728406582523,243.7048101193472,0.0016638721843661847,18.116070132020162,0.0","30653,881,276.845971841447,253.3112439163809,11.890955433802317,0.0013759556221717198,3.7293708841001383,0.0","30698,690,382.21272574870187,351.4587749189854,0.01715583418375802,0.002250132505440891,4.181017957426476,0.0","30714,575,234.09953916119858,217.40273425352427,0.006750470526224978,0.0012018639943298921,2.019851083027656,0.0028246734482181186","30728,1126,670.6830693939077,662.535950082798,0.022239394601657428,0.00046403180961843447,102.65403622725158,0.011528663353482696","30733,982,889.8605806913359,767.494307426689,1.0271813745312182,0.0025782914045064894,23.07281116814571,78.14491342079658","30735,768,1007.2834149301781,857.9589846906966,52.10894697672662,0.002182685948916521,44.85395105314873,0.002540188464224094","30795,863,198.04527965314995,193.2977014048145,0.0164930706024964,0.0004986269532661944,2.2326656593836756,0.0","30914,1004,804.0332144332787,713.1734288544876,28.16216344255715,0.003269692700678841,11.490807745656861,0.0","30939,658,506.43677271690757,449.56148714330755,38.25801532725543,0.001205848278066673,13.812810471066264,0.0035684312560034888","30958,1411,723.0310046679651,605.9520442701761,0.6151346413828842,0.0071355780944286525,8.268012589980483,0.0","30975,571,397.86093739669207,375.9251082974944,0.9399488639717785,0.0014118011107868294,8.985591791938377,0.0","30999,1433,448.5592843720527,436.1271309023681,2.3616693933918205,0.0011207814459992455,14.506731358162572,0.0009765648380643881","31067,1372,795.1682647347333,760.9844283200091,0.03110986767717271,0.002527998124267901,12.248575634155912,0.0","31079,538,259.5622999874677,189.06419336789457,0.010483086752310421,0.002798686595162466,16.45100319882743,0.0","31083,943,961.2393495689136,950.9535783686223,2.2527991259200757,0.0006676913516313745,55.08427780613803,0.0003755820805011467","31086,548,219.7656906671794,181.8022183023914,0.005590239413673521,0.0014591518707081832,14.161475979683372,0.0","31146,545,252.50264607796905,194.83369185049915,32.078080192332656,0.0019094631657366984,4.961908443947746,0.0","31147,509,454.51022134885756,433.34180310990087,0.40641787646518196,0.0011460786752953858,4.487350787289376,0.0017795109983983653","31205,720,273.00906815022415,239.21209769202343,0.010878906922683318,0.00306258641723047,1.7580837950443384,0.0","31302,921,552.0914972902547,510.75569934212075,5.010098178863122,0.0018923851059536557,23.501246461300948,0.0","31381,824,630.4591644991946,556.5319325073958,38.86058288838407,0.0020177706842895433,9.440468290932614,0.0","31444,533,300.8964825487235,264.1690928481344,0.8434829673740986,0.0025061959704263622,1.8590831682407647,0.0","31448,510,330.03518965101705,298.8087429937957,14.336989201241224,0.0006060824854306311,14.612032191819194,2.7063259260576715","31460,728,428.9534656027382,388.75173502811737,0.015547129874763995,0.0015552368358368366,2.798803898189505,0.0011361241444216325","31468,516,394.2025297846967,346.7491820821965,6.003246335651863,0.002855673828747393,11.304109258659816,0.0","31477,512,347.08739933154885,287.79873999800606,8.47489362634944,0.0019627239846015995,5.8947367510122675,0.0","31653,504,313.95386741856834,296.5842104354454,1.500905248513381,0.0005713169942775745,13.449390595928348,0.0","31675,1313,840.1520824580009,732.8236280345097,0.028196586890298123,0.0037820977613852555,15.12661473006635,0.0","31686,714,353.47325357849996,338.21248903132636,2.0150657281506223,0.0015034039411252215,55.29096250243413,0.0","31691,709,556.0629194322278,476.99336557706044,0.020343259527140348,0.003327655323477974,3.0640615487236245,0.0","31713,715,558.4318940178906,472.8372109615068,14.021687595919948,0.0017926959884870459,14.734107660347055,0.0","31730,582,180.23837512732916,162.7895046864956,0.008040505146983071,0.001585393222210016,1.4308558877417592,0.0","31751,1470,1335.5256796456401,1141.5980077843972,3.9317044105004024,0.007877524374922992,20.260273675857984,0.0","31781,627,180.79798294684346,146.8662564056557,2.708103358880383,0.0025306804285206356,1.9315053321120697,0.0","31821,848,798.6389057019959,719.2840457333383,0.01857168738965349,0.004055728921657351,16.833687734503265,0.00378444541837529","31937,1149,1067.3362501904273,970.4888845916008,45.56720848020444,0.002175202598663206,7.276717126676488,0.0008575038739384303","31939,979,242.1989395788341,238.3832596930415,1.1919398863436077,0.0004043276801462747,16.956386317889447,0.0","31941,1109,815.0734858911021,766.5316933706309,0.03403639225899084,0.002725420743116773,18.104813340775806,0.0","31968,1255,476.1430195501055,404.1843391792051,5.711135797037789,0.00685585180687671,5.740293084898288,0.0","31981,1240,393.48049289457475,380.252254228289,2.1501712778647795,0.0012364051019063452,45.29122721847719,0.0003634721687068288","32021,873,365.41439228477446,321.25352550742696,8.505220560285856,0.002230250473139077,31.687615589096325,0.002188217909305301","32035,719,415.7221442165095,367.08396904617206,22.954223256060597,0.0013258261420144792,9.451105609189565,0.0","32093,518,183.8304459972855,173.8448759198464,0.3899245684785937,0.00047032410083229894,10.17422210179727,0.0","32160,647,293.1925223137981,269.2758222550899,6.4521999222309905,0.0012093578972252512,5.881705288439584,0.0","32165,853,214.0801099851305,195.54578633019983,1.7586513820728256,0.0021891501099515847,8.071635324918716,0.0","32198,828,412.1221099885774,385.0383140870423,0.01454485472015958,0.001571939626773119,3.942239204414679,0.0","32205,682,258.3982152287877,239.78201397413275,0.011003770505083877,0.0015130612590664647,3.3823333827428845,0.0","32210,630,353.2960072068859,337.1502381876572,6.056171517613733,0.0007338697187330821,3.477891454093636,0.0","32240,525,358.42610968960355,336.0185122486008,0.010834804119132629,0.0012095949103639763,5.387155694098112,0.0","32255,1304,685.1621397494496,606.9539532764712,17.189118763683858,0.004123872016989872,73.66465306484186,0.0","32294,903,669.284077972248,443.88631237595234,207.50390437200022,0.0013950857862202873,11.657472807502021,0.0","32328,1245,820.2906300569794,748.2640328045342,10.354140474501683,0.003991613124395099,4.088461726041308,4.0226770693275316e-05","32329,1148,611.458237028236,582.0051337967799,9.05560311143698,0.0016234546395585867,18.66183174385166,0.0","32356,720,322.51821799104056,280.8274066695376,0.01638891357232597,0.0036299576561254344,5.762939897619109,0.0","32364,855,557.5199163120699,520.5719559828373,23.69429687715091,0.0010570468908518238,33.80819530588293,0.004101372914402816","32402,865,741.8731204483437,723.6024929074903,4.830970193670558,0.0008978531659459606,20.241791504976273,0.002063961899203961","32435,799,461.1826772709716,370.5704734985057,56.193123797266104,0.0026286674083003643,64.43757123143898,0.0","32545,1034,578.2644344229968,542.9499366675652,0.03281414198912204,0.0018639662877130672,44.62796544228759,0.0","32590,1095,557.0691638692496,411.5235611137084,47.148147022726846,0.006377629360744242,11.540350662341838,0.0","32643,951,403.61194432118907,282.9678628327251,32.708461739878715,0.0037197965019789094,41.990285778734886,0.0","32731,541,164.67957518519967,159.70938349590625,0.007638860803148323,0.0008909771823501199,2.813934536581674,0.0","32774,623,216.29134911913758,173.41297399363896,4.419489685685225,0.0022432409137240032,2.9380338243148403,0.0","32800,661,327.1552146254019,306.72645646198555,0.008906110742559696,0.0012960420573246449,7.93300201573573,0.0","32811,822,406.58643093747503,367.9548962800201,6.971385445695624,0.0030007434500297957,5.072876328381007,0.0","32816,825,539.3083881580792,526.4321149590546,0.01894276481216813,0.0010157563125169223,2.976122045862745,0.0","32834,751,479.2529516388235,376.6969777880987,17.080592338158905,0.0050426381336254565,7.276951793483231,0.0","32897,938,415.4050361927152,359.3698130419165,4.6405169325942355,0.004425227344477561,10.370705343604806,0.0","32903,613,211.46227847252234,193.46953072640625,2.027841398751074,0.0007294534704937647,3.3798991541605985,0.0","32933,969,565.588000751564,477.48419700230147,2.557101968703392,0.003229048750722997,10.75733427590886,0.0","32935,717,840.1349292198264,734.3085080249269,47.05373826495551,0.0008559694410361673,34.99688756975879,0.007516515639682562","33032,529,152.3048441845556,133.49758501409218,0.006429996714845066,0.0015223495527357468,1.429671334187238,0.0","33051,596,480.24926960130256,413.71918997438087,27.974908183741636,0.0027647503050566287,6.278642237860462,0.0","33061,955,915.9109837111081,821.913507331165,2.370113635256879,0.0028834764250018218,33.11771138656913,0.0019581291043248455","33087,686,394.84183399051255,352.8497879067605,0.930772958714048,0.002775608927517944,9.797096660824703,0.0","33112,778,826.2587932974515,734.3386897814202,46.21574484830603,0.0025326356833451588,24.5644445968395,0.0","33144,1746,1113.0045622445969,1072.2981752846347,2.172795532481424,0.0021360694245229133,10.892263412385594,0.0","33179,689,211.62149327658514,183.15797127104213,5.93534565302576,0.0029884390377873595,13.864758962436447,0.0","33213,555,334.0506786433049,300.15216267829186,0.01146608038670331,0.0015815061034650428,66.33694479116784,0.0","33236,1543,736.4745266029526,659.6701444261247,35.47676761974695,0.0032549400406277607,7.512868515897496,1.7411524377027084e-05","33238,793,350.1402857164496,305.60249069582295,4.178463256176825,0.002450428916103277,13.262963324105911,17.4813904838606","33241,518,176.255305654521,159.66259521546314,0.009474476719989204,0.0011370597014864231,3.1792780493248283,0.0","33244,852,472.90289668181657,426.1719022628675,17.70976716822967,0.0019416154156014693,17.787857518854622,0.0","33301,990,918.8033904461423,883.1743978665046,0.029564284004317227,0.0023436634584290644,11.421861930205976,0.0031442679489163947","33309,1297,659.6089389837066,566.7163412073816,8.537286525775185,0.005774614026066471,3.2660364849973336,0.0","33364,640,132.84636681175937,125.90159291578736,2.086583997012044,0.0009609326298739854,4.274739156155756,0.0","33369,518,281.55678941586336,248.4673373825927,12.758882418699695,0.00213616457570053,1.5301922001890904,0.0","33373,1269,588.0922050681575,573.0781838056067,6.118337784062445,0.001082383973040518,27.57728489314576,0.013977978548798162","33389,954,602.98866673821,547.6200585014877,15.85913423632674,0.0029341903413408715,8.27008683544443,0.0","33409,657,419.1765536327048,402.14037214997774,0.015510283813075695,0.002107918296932743,8.129357254539464,0.0","33412,686,381.98534475989993,371.31863575128284,0.008122577833491164,0.0007768643920761875,35.66880337011226,0.0052057653818089475","33420,563,291.9259649776715,272.01352318400046,0.011246175887069464,0.001352117262168526,4.453600715329801,0.0","33427,549,247.67813484553818,189.1935863986322,1.3706547613395925,0.0038539969228482047,4.0323860054689575,0.0","33433,901,781.5389938510435,671.5384460513183,10.638102270954205,0.0067249387039192135,23.3179458446671,0.0","33441,601,553.2687520763188,510.1050371304704,0.01186197194047946,0.000429033088335561,6.791617155423212,37.74922915553186","33442,796,227.26803617693392,186.34847937906926,6.851373891223739,0.003426555061359985,6.697285973235467,0.0","33445,788,719.2003406102149,653.7165223016646,8.302851163045467,0.003175344494318158,15.323400469579232,0.0","33446,599,461.03320803072864,449.0105057577929,0.01365838709429508,0.00034457818135423085,42.609867727187854,0.0","33490,575,265.4727061693512,222.85143003263235,15.082788665794082,0.002555101050795803,1.7814897661583127,0.0","33494,1348,616.0878439093052,555.5223977850685,0.027295110112303476,0.005337179331989088,22.22421853940495,0.0","33507,858,326.9016592801109,305.6799224423043,3.779737698017517,0.0008547323817779978,4.876122123078596,0.0","33579,665,344.5516498502205,286.57579575355874,0.007953631304584433,0.00550317736181275,23.965014375759292,0.0","33596,1254,988.9952537226225,925.1159957784583,9.25721703941912,0.0031385252102840906,16.087171564319807,0.0","33613,659,296.9709956737343,276.0884149189479,0.009938351703280057,0.001215495907223834,7.684862868684289,0.0","33712,503,683.1135905066562,525.2216481790806,31.65589091448972,0.00532439475704257,4.558813215361657,0.0","33763,642,363.3373604624575,288.9009686147107,25.20300774378991,0.0037099972318181303,14.170079684331318,0.0","33799,611,300.63647187404723,282.95389078255573,0.007544886192223284,0.0008316325907233397,4.398288940086799,0.0","33832,1005,576.5080906716154,539.5680787616386,6.595200330050408,0.0024740870616412696,12.979745395853188,0.006379951010782577","33838,515,154.56173765163626,142.9521747233415,0.010522737747828451,0.0016070633320259503,4.5424476390765625,0.0","33863,663,407.1962844297788,341.9334662784541,0.7679492454676813,0.00332524377753063,3.180288528019007,0.0","33922,521,267.28534906081427,250.4996436896617,0.012477771421607161,0.0014550661214642205,8.091031398635186,0.0","33938,905,584.1359710955252,525.1656525895442,2.003328855082254,0.0037839123998346163,12.494317343156474,0.0","33960,1277,457.5246865027335,433.30269567219176,0.023397165323757747,0.0023441464617384293,4.767531342433591,0.0","34053,883,290.1506966885345,264.2462889677225,3.4418101929796765,0.002175314481919581,3.2527993856210617,0.0046820415715246675","34061,816,382.07705236388324,330.9980974994633,2.333245126415513,0.004503151344794852,4.585878928458057,0.0","34076,571,134.3090860309687,125.88990225294742,0.010118765116603135,0.0005570095965817247,2.9845241494040886,0.0","34089,793,499.9559505279158,444.9002743070885,7.560158406436645,0.00231398263436658,34.94299754172234,0.0","34104,796,332.81201460675254,291.2026999622905,1.1526829816415298,0.003459731413066524,13.27303959972265,0.0","34148,1324,409.66628551798703,382.7832819013713,0.02019889834249758,0.0027062187501539583,24.46666133570125,0.0","34162,572,326.5282982287053,275.1703396625938,27.497660360270846,0.0014659092263524353,2.6910029578650123,0.0","34165,774,325.6992508575376,300.652068657247,0.011652563307364189,0.0014950038012211534,23.459714175429315,0.0","34174,613,187.30677098632356,175.17665681892157,0.0097594569969647,0.0006806705817253524,1.8260081993020723,0.0","34207,574,508.68381402887394,441.47504130363507,28.706703055680183,0.002064387509914215,5.488387109962512,0.0","34288,528,222.7997654402568,213.68359903984876,0.013901680254894607,0.0008032346067498667,1.4515089467730402,0.0","34322,557,107.4772384493377,98.36988764036772,4.059892278184307,0.0006534316968576095,12.178474829519004,0.0","34324,949,599.7586966215616,568.3737406635613,1.2009466479966813,0.0027197072324842385,7.193792036315454,0.0","34328,763,335.26597160382204,322.85122117192475,0.01881647799672975,0.0010229222305967816,41.142672874301496,0.0","34397,702,258.19449925016954,204.41527602162336,24.725960059282805,0.002206403235044072,2.9767709453673192,0.0","34440,710,242.78634106646982,226.01251192522574,1.2556624341733604,0.001382407219948098,4.946439586735279,0.0","34519,660,509.8960737737062,496.4388409548463,0.020164523508683616,0.0014599716254787636,3.1153954431586177,0.0","34531,1158,502.3558517254084,470.8557253916438,0.0329319546440692,0.004253848768456663,3.0804672631407786,0.0","34537,1296,962.9085570477065,843.5107846684443,15.014175281746292,0.0075508688091654565,44.40102288310396,0.0","34539,869,506.2543767502165,463.80566967488147,0.21439623050427645,0.0024615312672263577,16.660794261839,0.00645856826324884","34598,1257,754.0168263907643,665.8366451402951,0.03163219928831078,0.0055908553859762376,13.248156176727127,0.0","34604,592,378.89844498033085,267.6288750118552,71.76364372542018,0.001814525788158561,2.2568358578741754,0.0","34675,542,172.84322396399565,147.09209638764548,0.0061549290824376235,0.0018440159328705359,1.6918309005356202,0.0","34690,530,287.4874569787872,247.4557226431235,4.474626062637742,0.0025986044669299452,1.3774713162207946,0.0","34709,720,230.02721858832052,213.5705239001598,0.011289173712444967,0.0011956488217975394,27.09137655162946,0.0","34818,846,627.7616426666118,555.8117928335369,8.740377599319537,0.0026165998904252763,41.864547793061135,0.006421239342939653","34830,571,275.2881645159297,264.7500548830516,0.003642398169428107,0.0005204060350693698,59.61853826884266,0.011286589330977552","34852,1189,465.8417927838569,373.5863436263795,0.026259493863454834,0.007808383118833346,11.645819978446601,0.0","34860,833,516.3117539089488,451.4978949051355,0.5761030333444267,0.002866673296527506,11.547511143560087,0.0003846979226291569","34896,640,263.09879035649953,208.76621139421567,0.5214757968541884,0.003662018585503146,9.681455831648377,0.0","34906,1076,732.8607266616864,561.4160523343609,33.698838346020736,0.0073994008016019745,30.794786743017976,0.0","34969,1021,408.671863838756,381.2077392540022,2.1595664804740227,0.0039613196931016234,6.008854627873333,0.0","34977,606,172.665605028919,166.2319957692399,3.1671017501054335,0.00032234110896331534,10.510091324502019,0.0","34978,595,438.4964890292779,376.1951363725101,1.390774951422661,0.004115283497271981,4.614286241118869,0.0","34991,1145,246.0844392655598,222.27206189470684,0.23208209048666062,0.0021625317984170014,30.06607645753949,0.0","35062,602,432.44168720425745,421.3676852758972,0.004343710294139179,0.000555859552455405,82.86584687829824,0.008821202045206237","35166,769,428.1120059241284,356.1189121161328,2.5532007188176857,0.004419789424923555,5.315129751991025,0.0","35184,837,701.7631127243195,633.8075342139695,4.057354424059887,0.003445954073465641,8.64912343551173,0.0","35208,645,420.69327528141065,353.8285898544489,0.016660350098822937,0.003974384410203801,10.230099612758876,0.0","35337,1263,590.1101893039811,541.4938258278966,0.038810813386711926,0.004765140934832227,46.76725835386468,0.0","35342,687,230.3740486696765,219.48426284927865,0.008182317086205013,0.0010696243573095215,4.596495898710822,0.0","35388,966,470.8549377088867,388.3508276268169,1.2402620184181556,0.0043383981088544665,10.284965054026301,0.0","35412,734,826.7342518585533,811.9379488597234,0.019698153126667502,0.0011662391977206325,43.10059809127997,0.003232202043952888","35425,522,450.8036219949984,349.6807354993389,32.0732021256287,0.002756784870613102,5.998342537999525,0.0","35450,1165,360.5322186673261,321.8221111028421,0.15577565728755605,0.003808109329163705,4.504782010078088,0.0","35480,779,631.3804023518484,556.1401319653615,5.628490406105749,0.004280083217442712,13.134491758186996,0.0","35566,699,359.8979864532763,280.7438116501403,0.14873154468734423,0.004111104191398139,19.11136424342684,0.0","35595,598,175.4480495899964,131.98314814680325,0.00899069008806702,0.0033928894845318396,5.208293078962061,0.0","35657,542,255.5456831990424,242.336992356902,0.01057841970816795,0.00153756917850823,3.245755201607334,0.0","35723,610,495.62594450581037,399.35296876170486,50.19858617824056,0.003335539006516015,7.032003071439664,0.0","35743,656,386.19965796224864,370.7901091806416,0.011328924199998272,0.0010362708295164392,71.0743574956788,0.002758003355416434","35754,694,679.8567028409379,502.6981389028621,18.058921321676745,0.007400012009859705,27.097827239564626,0.001180563625820296","35779,1041,385.5069079771636,336.0523685185162,2.9606271716896635,0.005272790652504523,11.168112103458096,0.0","35800,508,343.7680733689637,309.01782076809224,0.5861833410971742,0.0015714181920816386,8.555951525702413,0.0","35849,643,285.85436504229614,231.6832106504635,0.3545628218271419,0.004099895573900227,10.386547421859708,0.0","35904,966,604.7661956928426,485.56839110934476,1.5746726525135444,0.006309894933218892,12.410083542185953,0.0","35927,1084,438.79670793982274,427.1632565787683,2.502297074932962,0.0013518221032314847,5.677117098735243,0.0","35962,730,631.6929679028416,565.9126064787608,0.2970824036875624,0.004054375971509152,6.958216265232573,0.0","35995,598,256.6799895338899,203.91876929673825,4.693360786487209,0.002493185918068914,11.158138858946755,0.0","36020,951,276.1032058546724,242.3259610672288,0.015368203567561049,0.002198857672533715,6.612527384746198,0.0","36021,564,181.85675487748728,150.11312759249873,0.006118172470279101,0.0030580192715858466,9.731243552261324,0.0","36027,872,424.26627206480197,397.7427063971569,2.0961716834417854,0.0023899805761399004,9.12288149767927,0.0","36028,623,378.1092136160154,360.836418314585,0.018082901334663365,0.0014753618379040332,5.3846165801508254,0.0","36054,527,385.42839663029525,356.74589244439466,0.011712028899174625,0.0023783395896231855,3.6231154633300346,0.0","36066,1094,225.09998103923718,203.23264280985484,3.746822571460065,0.003370786236909795,2.6799609522268932,0.0","36124,556,467.25019321865943,447.59884323873433,4.847870640720405,0.0005866406480672,6.774435746456471,0.0","36184,963,384.15029432021436,340.14682688582536,0.020114312034980025,0.002532515774227981,11.849655075887952,0.0","36189,598,341.2746388298796,329.2788021481277,4.375957045228526,0.0008324627463361257,8.208221749195177,0.0","36224,578,306.5378892527153,271.565152389908,0.010685644956040737,0.0015707675600236145,4.666944097242719,0.0","36250,1135,473.83863789978943,411.29343596364583,0.029141534149777933,0.005560059517176159,5.174857109228296,0.0","36266,672,334.03053420799273,316.2749581137976,2.753867015704477,0.00118224193812315,3.0477636520648024,0.0","36292,1341,839.591545772871,772.1295285137958,4.803342345187325,0.004449938937397125,2.2532695492857995,0.0","36341,590,429.6269680315332,354.1094854550543,2.649476813007018,0.00426971623924949,4.249474584907848,0.0","36450,571,189.82613021511708,170.54025890684167,0.005590454385653762,0.001762818357248827,2.00221388904547,0.0","36454,840,548.6829726041533,525.5788644187166,1.4690895662225123,0.0016724244402675193,8.838994027398554,0.0","36469,688,488.92429284707583,438.66205392761987,0.015578171804784552,0.002062283120619515,8.017969897650019,0.0","36472,687,173.40510006185414,170.8721290053566,0.007505339777229441,0.00031899915545889916,20.75366254174535,0.00014894122586484352","36474,745,318.3830862169987,280.90299210550245,14.473345545860074,0.0007540408371481394,29.485272979830032,0.008146817736290834","36519,1218,560.6339222814238,524.0437400503617,3.8545119652895794,0.001661831313271191,5.543425666359891,0.0","36522,804,507.160515374223,481.8136973757336,0.02030174376423745,0.0018218545986160165,6.925090384149443,0.0","36567,737,445.13810775221174,430.8891106665479,0.014129489776249612,0.0008199706745041207,50.91283938028782,0.004087758310916657","36587,607,318.0464889369681,285.23547070856796,1.2908688929094798,0.002636248001966986,7.526527119891131,0.0","36597,555,308.1694338389513,247.5173312216897,26.55488146467993,0.0015859694305548721,5.43776138224345,0.0009598165302312373","36603,595,410.2636331903304,317.8342590807774,0.012915453037372661,0.0057380395578671,18.98550681488208,0.0","36626,572,161.74464848820216,131.13748493101951,0.007700012237091571,0.00160070927914339,14.614552192227604,0.0002907735446231824","36653,585,343.41210205472635,319.03929695512176,0.016826325119758193,0.0018300212519590053,5.452747011021222,0.0","36669,504,356.31334821748544,269.45961776728063,13.14601741603496,0.003483155974616629,18.694249913616297,0.0","36670,850,538.2596620201771,499.0430666368844,0.012565848386770082,0.0015953080931461882,30.10447191161828,0.003636551819196189","36733,775,801.6019804527928,763.9333465813535,0.22754854104202735,0.0022041481544063544,23.293400893997553,0.0031612044458225463","36741,910,718.8505392321263,681.2031936519919,0.022950463733163555,0.0015670100095785844,7.557179243021607,0.0","36745,1433,664.8409729817428,629.4099006643307,4.867140503883001,0.0030680353966703166,20.70239169345139,0.0","36747,524,453.1675755436516,403.56089957189954,11.781574271612358,0.0022973360271590485,55.89029509227092,0.00557440843768775","36808,798,381.7152859562622,340.238671703742,1.660050899661045,0.0025577806849250147,13.088892493092716,0.0003477084410668053","36812,551,304.1580326453489,239.93227103769462,13.592979094790678,0.0025093500493895632,5.166555704646838,0.0","36821,538,189.96240453563388,178.3448705960121,0.008544521174867856,0.0005880089281606072,2.6717223994439623,0.0","36905,710,130.73436813338478,106.86611140545132,0.008008199304223775,0.0016499607742043016,11.629833408826027,0.00019984242284213228","36917,724,195.9917469310743,194.09843991349192,0.01050590568282493,0.0002952787634964885,10.165949576759969,0.0","36943,1227,695.3117495707112,615.629974900544,5.787245452843777,0.004526568759682646,6.674492994362181,0.0","36955,1249,870.3429727526615,827.9516342256467,0.020304239721715182,0.0027242789589848938,7.836789861702727,0.00414831360059025","36969,715,616.7912975011246,486.8059924113535,0.016565177251980097,0.005090185187607306,2.9894955383247286,0.0","36981,1239,585.0611959849729,541.2385832837218,0.6905706909254031,0.003976797050017674,5.181203356295148,0.0","37008,631,383.4520785973759,263.94614960458387,14.068493062664812,0.005746407350881521,10.158485670411888,0.0","37012,761,376.9586138820567,321.127524670024,11.560310053058654,0.002922582192803393,30.478004108413412,0.0007058448810359433","37016,1524,450.93797425391296,411.5748363764801,1.9164473444244232,0.0037362250763557825,5.070414167854335,0.0","37098,1022,816.7171194830527,708.1199500009408,3.6656599078696184,0.005081685817726024,9.750304176970076,0.0","37155,521,252.37891365074887,221.16524527014528,6.512273860931402,0.0011349984715896219,2.7562481111445836,0.0","37161,563,311.5554500650293,265.77788262737164,33.11226448689364,0.0008207531499602933,1.4837742041361315,0.0","37239,577,247.59158785257742,234.07618371106878,5.845737966752202,0.0011623113151245509,4.3807049163119425,0.0","37260,564,192.56453234547334,175.30590440414207,0.011518402544382318,0.0011755957726591322,7.62593925621908,0.0","37266,863,203.5984476628593,159.5508555993232,8.970792743736192,0.004068591827578651,13.089180593885283,0.0","37273,542,304.85416739464085,267.4778678540218,16.8512539976671,0.0013841806086358033,5.784894762858415,0.0","37286,705,521.7171831524735,438.92775137386263,18.101152174703653,0.0038882505163649606,26.1746752202236,0.001222039535241942","37290,617,418.53223973337595,411.33220916414854,0.0055437300925332035,0.00031997711013368016,67.78364246329647,0.009269109502062165","37347,532,240.22042486249072,233.10083659976786,0.015077526334385822,0.0009565383348712174,3.2130304657110944,0.0","37348,597,414.70033626169106,387.2178597870896,0.017757108144363456,0.0020163197804712926,1.4786838350846827,0.0","37381,1124,789.591051771265,683.8267564115271,1.54873232442764,0.0044449659085800345,4.990698569732103,0.0","37499,673,265.9672274369589,233.90132498106638,0.012025254872071916,0.0029337723203368454,2.133133663254254,0.0","37505,741,485.94175590585894,384.4322427601326,0.013366628806658825,0.004967115829405377,3.8673372912731407,0.0","37529,521,227.86126900371403,186.4937019414691,24.810004126692057,0.001584485460655676,8.681902211918548,0.0","37757,691,227.28526202599897,168.21068950382593,35.294512143732646,0.002629322368466807,3.15586222376636,0.0","37964,1043,666.0907114147739,618.9050332316119,13.591778745979756,0.0026548763778768266,11.930826421378855,0.0","37972,1507,949.5245918151384,837.0662093925484,0.04663141868528969,0.007273297234656077,35.38317416286283,0.0","37979,607,307.1022918718394,253.41952572347117,11.167340707213766,0.00235035720819178,6.06178158131891,0.0","37983,645,492.6704026428927,406.0586481223198,5.193523885947237,0.004355840707814951,5.346153847581728,0.0","37985,1690,474.9720419241519,456.6922454660174,2.4218985596048146,0.00166196529594141,17.33917298696147,0.0"],"holdout":{"mean_edge":157.44525585431995,"retail_edge":183.25437166379288,"arb_edge":-25.809115809486425,"failures":0},"diff":{"mean":0.5890087708068658,"standard_error":0.053430595103799994,"retail":-0.0947814668490963,"arb":0.6837902376568405,"trimmed":0.6226531380202396,"runs_up":792,"runs_down":188},"others_identical":{"runs":900,"identical":true},"seconds":{"start":99.3825714350678,"yours":98.04395653726533},"code":"\"\"\"Crossing-cover base with isolated, untuned per-spread overrides stacked: each acts only in runs of its own competitor spread.\"\"\"\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)\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        self.flow_notional = 0.0\n        self.flow_exposure = 0\n        self.last_ask_tick = None\n        self.last_quote_exposed = False\n        self.last_flow_ca = None\n        self.last_flow_cap = 0.0\n        self.last_flow_correction = 1.0\n        self.params = P.copy()\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            if self.s == 4:\n                # Use the existing low-price risk penalty on bids too; inventory\n                # cover orders already provide the separate stocking mechanism.\n                self.params['kLb'] = self.params['kLf'] = self.params['kL']\n                # Censored compound-Poisson flow likelihood, using only our fills.\n                self.f4_exposure = [0, 0]\n                self.f4_events = [0, 0]\n                self.f4_weights = [[0.0] * 9, [0.0] * 9]\n                self.f4_means = [2.64 + i * (6.336 - 2.64) / 8 for i in range(9)]\n                # Positive aggregate flow is approximately lognormal; +0.065\n                # accounts for the occasional second arrival in a timestep.\n                self.f4_mu = [math.log(m) - 0.72 + 0.065 for m in self.f4_means]\n                self.f4_last = [None, None]\n                self.f4_rate = 0.1265\n                self.f4_mean = 4.488\n                self.f4_flow = self.f4_rate * self.f4_mean\n                self.f4_extreme = inv(1 - 1e-6)\n            if self.s == 2:\n                self.params.update(dict(W=150, ammo_pmax=0.02, fy=0.7, fu=0.25, Hu=500))\n            if self.s == 1:\n                self.params.update({'dmin': 0.3, 'pfl': 1e-06})\n            if self.s == 3:\n                self.params.update({'flow_prior': 200, 'flow_level': 0.6, 'flow_strength': 1.0, 'flow_safety': 2.0, 'flow_exposure_min': 5.0})\n        P = self.params\n        if self.s == 4:\n            for side, filled, bound in ((0, state.sell_filled_quantity, ca), (1, state.buy_filled_quantity, cb)):\n                last = self.f4_last[side]\n                if last is None:\n                    continue\n                tick, conv, cap, old_bound, ids = last\n                if (side == 0 and bound > old_bound + 1) or (side == 1 and bound < old_bound - 1):\n                    continue\n                # Track only the main quote, excluding probes and stock orders.\n                remaining = sum(o.remaining_quantity for o in state.own_orders if o.order_id in ids)\n                value = max(0.0, cap - remaining * conv)\n                self.f4_exposure[side] += 1\n                if value > 0.01:\n                    self.f4_events[side] += 1\n                    censored = remaining < 0.011\n                    logv = math.log(max(value, 0.01))\n                    weights = self.f4_weights[side]\n                    for i, mu4 in enumerate(self.f4_mu):\n                        z4 = (logv - mu4) / 1.2\n                        weights[i] += math.log(max(1e-12, 1.0 - cdf(z4))) if censored else -0.5 * z4 * z4\n            if state.step % 25 == 0:\n                exposure = sum(self.f4_exposure)\n                events = sum(self.f4_events)\n                event_probability = (events + 80.0 * (1.0 - math.exp(-0.1265))) / (exposure + 80.0)\n                self.f4_rate = max(0.077, min(0.176, -math.log(max(1e-6, 1.0 - event_probability))))\n                weights = [a + b for a, b in zip(*self.f4_weights)]\n                peak = max(weights)\n                weights = [math.exp(w - peak) for w in weights]\n                self.f4_mean = sum(m * w for m, w in zip(self.f4_means, weights)) / sum(weights)\n                self.f4_flow = self.f4_rate * self.f4_mean\n        if self.s == 3 and self.last_quote_exposed and ca <= self.last_flow_ca + 1:\n            self.flow_exposure += 1\n            self.flow_notional += min(self.last_flow_cap, state.sell_filled_quantity * self.last_ask_tick / 100.0) * self.last_flow_correction\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            if self.s == 4:\n                exp = math.exp\n                if self.bc == cs and 1.0 <= wid <= 6.0 and nb == 8 * wid:\n                    # On this stationary grid, spacing is exactly 1/8 tick.\n                    # Equal index distances therefore have bit-identical d*d*k.\n                    # Reuse exp values while retaining the original sum order.\n                    kernel = []\n                    c0 = cs[0]\n                    for ci in self.bc:\n                        d = c0 - ci\n                        d2 = d * d * k\n                        kernel.append(exp(d2) if d2 > -12.5 else 0.0)\n                    kernel = kernel[:0:-1] + kernel\n                    for i in range(nb):\n                        t = uni\n                        start = nb - 1 - i\n                        for wi, e in zip(self.bw, kernel[start:start + nb]):\n                            if e:\n                                t += wi * e\n                        ws.append(t)\n                else:\n                    previous = tuple(zip(self.bc, self.bw))\n                    for c in cs:\n                        t = uni\n                        for ci, wi in previous:\n                            d = c - ci\n                            d2 = d * d * k\n                            if d2 > -12.5:\n                                t += wi * exp(d2)\n                        ws.append(t)\n            else:\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            if self.s == 4:\n                ja = jb = 0.0\n                for p, w in jp:\n                    if x > p:\n                        ja += w * (x - p)\n                    else:\n                        jb += w * (p - x)\n            else:\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            if self.s == 4 and tail <= 1e-6:\n                return min(P['qmax'], math.exp(mu + P['sig_n'] * self.f4_extreme) / px)\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            if self.s == 4 and phat * 100 - t < P['dmin']:\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            if self.s == 4 and t - phat * 100 < P['dmin']:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if t - phat * 100 < P['dmin']:\n                return 0.0\n            if self.s == 4:\n                tail = b * kA / max(self.f4_rate * a, 1e-30)\n                if a <= 0 or tail >= 1.0:\n                    return 0.0\n                return min(P['qmax'], math.exp(math.log(self.f4_mean) - 0.72 + 1.2 * (self.f4_extreme if tail <= 1e-6 else inv(1 - tail))) / (t / 100.0))\n            if self.s == 2 and phat < 0.1:\n                a = max(0.0, a - 0.0015 * (1 - min(1.0, state.yes_inventory / 3000.0)))\n            return 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            threshold = max(P['min_ahead'], 20 * 100.0 / comp) if self.s == 3 and step == -1 and 1 <= comp <= 5 else P['min_ahead']\n            if sticky and sum(o.remaining_quantity for o in orders if o.price_ticks == comp and o.order_id in self.ahead) >= threshold:\n                return comp\n            return comp + step\n        bid_t = top(bids, cb, 1)\n        ask_t = top(asks, ca, -1)\n        qb = qbid(bid_t)\n        qa = qask(ask_t)\n        if self.s == 1 and ask_t == 2 and ask_t < ca and phat < 0.01:\n            qa *= 5\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            flow_scale = self.f4_flow / 0.6 if self.s == 4 else 1.0\n            target = min(flow_scale * P['ydem'] * min(H, P['W']) / x, capw)\n            full = min(flow_scale * 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            stock_rate = P['ydf1']\n            if self.s == 4:\n                stock_rate *= self.f4_flow / 0.6\n            if self.s == 3:\n                flow = (self.flow_notional + P['flow_prior'] * P['flow_level']) / (P['flow_prior'] + self.flow_exposure)\n                scale = max(0.5, min(2.0, flow / P['flow_level']))\n                stock_rate *= 1.0 + P['flow_strength'] * (scale - 1.0)\n            q1 = max(0.0, stock_rate * min(H, P['Wf']) / (self.s / 100.0) - Y)\n\n        # Bridge expected retail demand until another tick crossing is available.\n        if 0.02 < phat < 0.1:\n            ct = max(2, min(99, int(math.floor(ptick))))\n            wealth = state.cash + Y * phat\n            goal = min(1 * qa, 0.3 * max(wealth, 0.0) / phat)\n            if Y < goal and ct < ask_t:\n                amt, qam = ct, min(3000.0, goal - Y)\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 o.price_ticks == t and q > 0 and (kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0) or (self.s == 1 and (o.side is Side.SELL) and o.price_ticks <= 2 and o.order_id in self.ahead)):\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                if self.s == 2:\n                    ub = min(ub, max(0.0, free - 200 * min(1.0, H / 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        if self.s == 3:\n            self.last_ask_tick = ask_t\n            self.last_flow_ca = ca\n            exposed_qty = ka + sum(o.quantity for o in out if o.side is Side.SELL and o.price_ticks == ask_t and o.quantity > PROBE)\n            self.last_flow_cap = exposed_qty * ask_t / 100.0\n            self.last_quote_exposed = ask_t / 100.0 > phat + max(0.005, P['flow_safety'] * self.st / 100.0) and self.last_flow_cap >= P['flow_exposure_min']\n            if self.last_quote_exposed:\n                logcap = math.log(self.last_flow_cap)\n                mu_flow = math.log(P['m']) - 0.5 * P['sig_n'] ** 2\n                clipped = P['m'] * cdf((logcap - mu_flow - P['sig_n'] ** 2) / P['sig_n']) + self.last_flow_cap * (1.0 - cdf((logcap - mu_flow) / P['sig_n']))\n                self.last_flow_correction = min(3.0, P['m'] / max(clipped, 0.01))\n        if self.s == 4:\n            self.f4_last = [None, None]\n            # Eligibility is decided before observing fills, so depleted quotes\n            # remain in the sample as right-censored observations.\n            for side, tick, bound, conv, distance in (\n                (0, ask_t, ca, ask_t / 100.0, ask_t / 100.0 - phat),\n                (1, bid_t, cb, max(phat, 0.05), phat - bid_t / 100.0)):\n                if distance < max(0.01, 3.0 * self.st / 100.0):\n                    continue\n                if side == 0:\n                    if not (ask_t < ca or any(o.price_ticks == ask_t and o.order_id in self.ahead for o in asks)):\n                        continue\n                    orders = asks\n                    order_side = Side.SELL\n                else:\n                    if not (bid_t > cb or any(o.price_ticks == bid_t and o.order_id in self.ahead for o in bids)):\n                        continue\n                    if (qam > 0 and amt >= bid_t) or (q1 > 0 and bid_t <= 1):\n                        continue\n                    orders = bids\n                    order_side = Side.BUY\n                tracked = {o.order_id: o.remaining_quantity for o in orders if o.order_id in kept_ids and o.price_ticks == tick}\n                tracked.update({o.client_order_id: o.quantity for o in out if o.side is order_side and o.price_ticks == tick and o.client_order_id is not None})\n                cap = sum(tracked.values()) * conv\n                if cap >= 0.5:\n                    self.f4_last[side] = (tick, conv, cap, bound, tracked)\n        return actions + out\n","code_sha256":"41f2bb431d34c009ae17d19e19551fbce150cd1b23166374e759ed4f92f0a570","tried":["Remove above-probability ammunition refills: discovery diagnostic, n=309, mean=0.16290298170420753, retail=-0.3158293258948222, arb=0.47873230759579294, trimmed=0.2078419280346028, up/down=73/7.","Remove low-price bids when above existing 200-step stock target: discovery diagnostic, n=309, mean=-1.340853434446927, retail=-2.39756332801683, arb=1.0567098935546926, trimmed=0.11218257671730004, up/down=89/56.","Shorten stock horizon to 1000: discovery diagnostic, n=309, mean=-0.07420303314110051, retail=0.0, arb=-0.0742030331427184, trimmed=0.0, up/down=7/3.","Shorten stock horizon to 500: discovery diagnostic, n=309, mean=-1.1020392822527494, retail=-0.14688616134789656, arb=-0.9551531209084141, trimmed=0.12059022668823591, up/down=29/18.","Restore existing kL on all low-price bids (same rule as submitted): discovery diagnostic, n=309, mean=0.5916321883019424, retail=-0.1392597911349518, arb=0.7308919794339807, trimmed=0.4706406707370243, up/down=122/30.","Numeric full-stock risk probe 0.3: discovery diagnostic, n=309, mean=0.49011199923042315, retail=-0.4645904985608411, arb=0.9547024977919094, trimmed=0.5800712216017322, up/down=116/31.","Use existing normal-price risk only above stock target: discovery diagnostic, n=309, mean=0.3515502741498393, retail=-0.7548943436647249, arb=1.106444617813916, trimmed=0.5340311833560574, up/down=109/39.","Raise low-price ask cap to 12000: discovery diagnostic, n=309, mean=0.08961231701747568, retail=0.11114326073300972, arb=-0.021530943715857623, trimmed=0.0, up/down=6/4.","Remove main bids below 5c: discovery diagnostic, n=309, mean=-3.082432580300646, retail=-3.5760014841857606, arb=0.4935689038592233, trimmed=-0.685585732984428, up/down=75/77.","Remove main bids below 2c: discovery diagnostic, n=309, mean=-0.2100393695731394, retail=-0.3467768867110024, arb=0.13673751713268611, trimmed=0.11912922867681572, up/down=102/36.","Limit ammunition overpayment to 0.005: discovery diagnostic, n=309, mean=0.009457995982201334, retail=-0.210072707216181, arb=0.21953070319741097, trimmed=0.07512857475986225, up/down=52/7.","Limit tick-1 stock target to 10000: discovery diagnostic, n=309, mean=-0.74832610304466, retail=-0.0799373375459547, arb=-0.6683887655016181, trimmed=0.0, up/down=10/8.","Restoring existing kL on low-price bids, discovery [30000,34000): {\"runs\":1026,\"mean\":0.5395040516642303,\"standard_error\":0.08597329974012581,\"retail\":-0.10240573364035155,\"arb\":0.6419097853049708,\"trimmed\":0.5771069476670978,\"runs_up\":394,\"runs_down\":96,\"failures\":0}","Restore kL only above existing stock target, discovery only: {\"runs\":1026,\"mean\":0.5143329677070178,\"standard_error\":0.07699818646452122,\"retail\":-0.06627613445107236,\"arb\":0.5806091021576997,\"trimmed\":0.5383276258343939,\"runs_up\":404,\"runs_down\":80,\"failures\":0}","Numeric horizon/cap/risk probes were rejected as a basis for a setting; no new numerical constant is submitted. Remaining numeric sweep cancelled. Submitted rule restores the already-existing kL coefficient.","Calibration: python3 -m orderbook_pm_challenge run ../early.py --simulations 600 --seed-start 1000 --workers 4 --json; Python 3.12.3; no sandbox; 600 successes; exact mean 108.63974289615767.","Other-spread comparison checks every SimulationResult field, 300 seeds per spread 1/2/3 from 90000 onward. Timing runs 200 spread-4 seeds for each strategy serially in one process."],"next":"Measure a structural stock-order cap based on already available expected retail demand, and distinguish ask-capacity misses from competitor ladder movement. Do not enlarge asks based on a static tail-fill estimate alone; the competitor refresh path changes. Confirm on fresh seeds before combining seats."}