Skip to content

The L2 replay flags

Part of the reference tier. The map of the documents is MAP.md. How to run one is the guide's part 1.

l2_replay takes six positional arguments and then flags:

toy_quant l2_replay <trades_csv[.gz]> <depth_or_incremental_csv> <symbol> [ms_delay] [strategy] [quantity_scale] [queue_model]

The binary prints this page's spine itself -- toy_quant --help -- grouped the same way, and lint_prose.py fails the build if a flag exists in the parser and in no document, so the two cannot drift apart. What follows adds the part a one-line usage text cannot carry: which flags change what a run prints, and the two or three caveats each has.

Strategy names

The active L2 line is one class under several signal configs, which is why the names outnumber the classes. The L1 names are frozen: they exist so recorded results stay reproducible, and new work belongs to the L2 line. They are not built by default: configure -DBUILD_LEGACY_L1=ON to compile them; the default build accepts the names and refuses each with "the legacy L1 line is not built".

name what it is
passive_l2 depth-aware reference baseline (l2_baseline is the same config)
l2_depth, l2_micro, l2_flow the same class with one signal isolated: depth, micro-price, or trade flow
flow_aware_l2 flow and depth together
inventory_aware_l2 the same root with the inventory shift in the quote
active_l2 the mainline: depth, micro-price, flow, inventory limits, toxicity and weak-flow guards, volatility adaptation
adaptive_l2 compatibility alias for active_l2
trend_l2 the non-market-making line: an EWMA cross sets a target position, clips at the touch build it, and a stop, a time stop or the exit band closes it
execution_l2 the execution line: works one parent order, takes no view on direction, reports [EXECUTION_ALGO]
optimized, naive the touch-only baselines; neither implements the L2 entry point, so neither sees depth
l1, passive_l1, inventory_aware_l1, flow_aware_l1, active_l1 the frozen L1 line; l1 is the complete replay-oriented one and the others are its reference baselines

Sizing, and the trap under it

--order-size and --inventory-limit override what the instrument derives: order_size = quantity_scale/1000 and inventory_limit = quantity_scale/10. That derivation assumes quantities are fractional, and BTC-PERPETUAL declares quantity_scale = 1 because its quantity is already a contract count -- so without the two flags a perpetual run quotes one contract and holds at most one, every PnL is a few cents and the inventory logic is unreachable. A run that wants to watch a position build names both: --order-size=10 --inventory-limit=100.

The flags, by what they change

purpose flags what to know
which data the six positional arguments, --fast-validation --fast-validation skips the per-event checks a replay of known-good files does not need, and is what every recorded run uses
quiet --no-output suppresses the per-event lines, not the summary
quoting --base-spread-ticks, --refresh-price-ticks, --inventory-shift-ticks, --edge-cover-ticks, --min-spread-ticks 0 leaves each at the strategy's own setting; --base-spread-ticks=1 quotes at the touch. --advance-debounce-ms=D holds back only the side that would move towards the market, for D ms after the fair price last moved, while the side that retreats goes out at once -- measured at 10 ms it turned a -4.61 bps closed median into +12.40 on 6 of 7 days and halved the fills, and at 80 ms it changed nothing. --close-side-ticks=N brings the side that reduces the position in to N ticks while it is not flat, and at 10 ms with the debounce it read +11.41 on 4 of 7 days against the debounce's +12.40 on 6: it trades capture for turnover and does not pay here. --extra-layers=L quotes L further passive layers one tick behind the first, and at 10 ms with one contract it lifted the fills from 17 to 26 a window and the closed median from +12.40 to +26.18 on 5 of 7 days (recorded; the re-derivation reads +9.83, and the recorded value is archived 2026-11-26 as unreachable -- the layer buys fills and gives up capture) -- the inventory goes from 3-9 contracts to 4-10, so it is a sized decision rather than a free one. --jump-window-ms/--jump-ticks/--jump-cooldown-ms pull the quotes when the mid crosses --jump-ticks inside the window and hold them off for the cooldown; at 10 ms that fires often enough that the fills fall to 0-1 a window, which is why all of these default to off. The first version of this table explained it as "two ticks in 40 ms is normal on a half-basis-point tick", which was 10x low on the tick (5.2 bps here) and is not the mechanism; the measurement is the fills, the cause is not established
quote geometry --quote-distance-bps, --onesided-inventory-frac, --throttle-adverse-bps, --throttle-units --quote-distance-bps=D sets the half width in basis points of the reference price and the strategy turns it into max(2, round(D / tick_bps)) ticks, one tick being worth tick / price -- the same economic distance on every instrument, where a fixed tick count is 3 ticks (16 bps) on UP and 3 ticks (22 bps) on DNA. It and --base-spread-ticks set one distance and are refused together. --onesided-inventory-frac=F stops the adding side at F of the inventory cap, so the position is worked down by the closing side alone; the cap is the same rule at 1.0 and F acts earlier. Both default to off, so every recorded number stands
the halt --pause-ticks-per-second=D the threshold of ActiveL2MarketMaker's volatility halt, which is 9.0 and always on in every recorded run. Measured 2026-11-28 UTC after the divisor fix, the parameter is a lever and the frozen value is the best of the three tested: on the frozen cell over 2026-11-16..22 the closed medians read +16.82 at 9, +13.85 at 20 and +11.79 at 50 (about off), positive days 6 of 7 against 6 and 5, and the pause counts 45 / 8 / 0 say the lever is what moved them -- so loosening it costs 5 bps of median, and the sentence this row used to carry ("every value from 1.0 to 50.0 lands in the same place") was a property of the divisor defect and is withdrawn. What the sample does not say is where the optimum is below 9. A large value is what turns it off, and 0 leaves the strategy's own 9.0 so a run that does not ask for it is unchanged
the halt on the price's ruler --pause-bps-per-second=B the same threshold in bps a second, converted at the current mid: the form that can travel between instruments, since a tick speed cannot (6 ticks a second is 31.6 bps/s on UP at 0.19, 9 bps/s on a 1.5-bps tick and 72 bps/s on a 12-bps tick). The two flags are mutually exclusive -- the parser refuses a command line that names both, because a row has to say which ruler its number was measured on. Built 2026-11-29 and not yet measured: the bar is Tier 1 #10's, the registered 6-against-9 ordering re-derived in bps/s on UP's sixty days, then one threshold carried across BLUR/DNA/BABY with no pause count exploding on one instrument and vanishing on another
the reduction slice --inv-above-frac=F how long the position sat at or above F of the --inventory-limit cap, and what the marked net did in that time: [EXECUTION] prints inv_above_frac, seconds_above_inv_frac and pnl_bps_above_cap when the flag is above zero, and nothing when it is not, so every recorded line stands. The sample is taken after each event's own effects, on all three entry points (the generic reader, the L2 view and the L2 trade -- a fill arrives on the last and a slice hooked only on the first measures nothing on the mainline, found by its own test). The PnL is a difference of two marks of the run's own net, marked by the slice itself because advance_mid marks only for an armed kill switch, so a carried position is priced as a carry rather than at its entry. --inv-above-frac without --inventory-limit is refused: a fraction of no cap is a fraction of nothing. Built 2026-11-30; the two-value smoke on 2026-11-26 at 100 ms read 41.8 book seconds and -9.57 bps above the 50-contract cap against 242.8 seconds and +14.05 bps above the 100-contract one -- the same day, both signs
repricing --amend-instead-of-cancel, --amend-deadband-ticks=N move a quote in place instead of pulling it and placing it again: one round trip instead of two, and the order never leaves the book. What it costs is the queue position at the old price, because the amended order lands at the back of the level it moves to; a layer behind a primary keeps the cancel path, since folding it onto the primary would collapse the ladder. The venue leg was measured at 83.2 ms p50 against cancel-and-place's 163.1, and this replay's engine amends in place, so the request is a queue reset rather than a cancel. For the maker, --amend-deadband-ticks is how far the target must retreat before the amend fires: 2.0 by default, which is the deadband the recorded arm was taken with, and 1 is the arm registered against it because the symmetric version amended on a single tick, took fills from 26 to 49 a window and the closed median from +9.83 to -5.92. On execution_l2 the same flag is the resting child's follow: it moves with the near touch, both directions, at 1.0 tick by default, because a child that does not follow a tick is not at the touch and the parent still has to be worked -- and an engine without an amend answers with the cancel it replaced, after which the slice is posted again rather than crossed
the state --amend-on-toxicity, --toxicity-imbalance=N the switch between the two measured repricing arms: the cancel path while the book is calm and the two-tick retreat amend while it is toxic, where toxic is the mid's range over --jump-window-ms past --jump-ticks (active_l2's detector, no cooldown needed) or the recent flow past N of one side (default 0.9, i.e. 95 per cent of the last thirty-two prints). Off by default; the two branch counters are in the strategy's own metrics, because a state that never fires reads exactly like a switch that does nothing. Measured 2026-11-26: on UP 11-16 the arm took 9,571 amends against 13,707 cancel-path refreshes, and across UP, NES and PROS it lifts the per-fill capture (+0.37 bps of closed median on UP, +5.16 of net on NES, +1.39 of closed median on PROS) without losing a fifth of the fills and without converting a day -- PROS stays at 4 of 7 and UP's positive closed days fall 5 to 4. At ten contracts on UP (2026-11-26) it buys the tail and pays the median: the worst net day goes from -202.88 to -76.38 bps -- 126 bps, the widest tail improvement any arm in the family has read, because the carried inventory falls from a -168.76 bps mark to -6.38 and the loss becomes a quote loss -- while the closed median falls to +2.05 on 4 of 7, the settled median turns -9.42 and the dispersion gate fails on both conditions. Refused at that size, and the next registration is a stricter definition with both halves in its bar
the wind-down --wind-down-skew-minutes=M, --wind-down-end=HH:MM, --wind-down-skew-ticks=T, --wind-down-adverse-bps=X the maker's own inventory skew for the last minutes of a named session: the adding side stops opening and the closing side walks in towards the touch, up to T ticks (one by default), in whole ticks as the clock advances. The end is a UTC clock because a strategy inside a replay cannot see where the replay stops -- --close-out only runs when the input ends. Both are off by default and both are refused on a strategy that does not carry the layer. The closing side is exempt from --advance-debounce-ms: a deadline outranks a debounce. X makes the skew conditional: it starts only when the carried position is marked against us by at least X bps, and a favourably marked tail is left to settle. Measured 2026-11-26: the median absolute residual falls from 50M and 20M units to zero on both seats at a settled median of +6.00 against +12.75 (UP) and -10.24 against +0.51 (NES) -- the tail can be worked, and this week's mark did not repay it. The condition was then wired and asked at ten contracts (2026-11-26) and it is refused too: it selects the adverse days exactly (three of them reproduce the unconditional arm bit for bit) and the arm still reads a closed median of -2.13 on 3 of 7 against the control's +10.32 on 5, with the worst day at -123.02 against -34.12 -- the skew sells into the run rather than avoiding it, and the carried mark does not predict the tail's direction (11-16 and 11-21 were both marked in our favour; the skew helped one and cost 27 bps on the other)
the hold-timer --max-hold-seconds=S, --hold-skew-ticks=T once a position has been carried past S seconds, the side that closes it walks in towards the touch by T ticks -- the position-age analogue of the wind-down, keyed to how long the tail has sat rather than the clock. Both off by default (S=0); the point is to cut the inventory carry's variance, the window's 10x term, by shedding a stale tail before its carry keeps compounding. Not yet measured -- the bar is a shallower tail with the median not below the control
sizing --max-depth-ratio=F, --depth-ladder-max=N no rung larger than F of the same side's displayed touch size, and a quote above that cap split into up to N rungs one tick apart, with the excess dropped and counted (depth_capped_rungs, depth_unquoted_quantity). The case is the size wall the fine-tick branch hit -- BLUR at thirteen ticks reads +31.74 bps closed at one contract, +23.66 at ten and +9.32 with a net of -2.87 at a hundred. Off by default, refused together with --extra-layers (two ladders), and refused on a strategy that does not quote. Measured 2026-11-26: at a 0.15 cap with one rung BLUR's hundred-contract cell reads a closed median of +43.76 on 5 of 7 days, identically under conservative, against the uncapped arm's +9.32; four rungs instead of one destroys the cell (38 fills to 6, +9.32 to -2.15) because the rungs sit behind the quote the sweep reaches, and NES at ten contracts is worse than its uncapped control either way -- so the lever is a fine-tick one
layer geometry --layer-step-bps the step between extra layers in basis points of the reference price; 0 leaves one tick a layer, which on a 0.76 bps tick puts the second layer almost on the first layer's price
the trend line's signal --trend-signal=ewma\|burst, --trend-burst=ticks=T,window_ms=W,obi=F,hold=VIEWS ewma is the recorded fast/slow cross of the midpoint and the default; burst replaces it with the event the maker's halt fires on -- a mid range of T ticks inside W milliseconds of book time -- taken only when the displayed-depth imbalance is F of one side on the same sign as the move, and held for hold views with the framework's stop, time stop and cooldown still above it. Its entry stays --trend-entry=side=own --post-only, where the fee reads exactly 2.00. Measured 2026-11-26: NES 5 of 7 positive days at +2.12 closed, UP 1 of 7 at -5.18, both under the +4.00 round trip, and the family is sealed
risk --max-position, --max-exposure-usd, --kill-switch-loss-usd, --fat-finger-bps, --max-orders-per-second with --order-burst --max-exposure-usd is enforced once named and reported either way
account --starting-cash the cash the account opens with (default 1000), which is also the exposure ceiling; a live run against a funded account passes the venue's balance, or venue to read it off the account at start (which makes the at-start [RECON] a tautology, so the at-end line is the accounting check)
fills --participation-limit, --time-in-force, --post-only, --arrival-share, --queue-chunks, --queue-seed the queue model is the seventh positional argument, not a flag; the kind of order is what the venue's ordType says, so --post-only is post_only and an IOC is ioc rather than a limit that rests
latency --order-latency-us, --cancel-latency-us holds the order or the cancel for N microseconds, converted into the market clock's own unit (clock_units_per_second), so 100000 is 100 ms on a millisecond cut: the flag's unit is the flag's and the clock's is the clock's, and adding the number raw made every OKX run a thousand times slower than it said (measured 2026-11-28 UTC). Without a latency --post-only changes nothing in a replay, because the quote and the book are the same event and nothing is marketable on arrival. With a latency a quote that lands in a book that moved is declined, which is the whole of the flag's effect -- and why a replay without one cannot measure it. A cancel naming an order the venue has not received yet is held and applied when the order lands, which is the case a market maker's requote meets on any link where the two legs share the delay
fees --maker-fee-rate, --fee-schedule a schedule names min, regulatory, clearing, audit, rebate, commission; every term is zero unless named
gates --markout-cover, --flatten-band, --markout-horizon --markout-cover needs active_l2; --markout-horizon moves the cycle count behind the markout itself
output --metrics, --trace-order, --record each adds a line or a file and changes no number
the one that does change a number --close-out, --close-out-cross-bps flattens the carried position at the touch and prints [WIND-DOWN], so [PNL] becomes realisable instead of a mark; the band puts the closing IOC through the midpoint for a live venue whose book is not the market leg's last snapshot
the reduce-only exit --reduce-only-exit inside the wind-down the closing side becomes a taker at the touch, for what is carried and never more: it flattens instead of walking, never opens the other side and never flips, and --close-out stays the fallback for a partial fill. Off by default, so every recorded wind-down row stands. Measured 2026-12-01 on the seat's 28 days at 01:30-04:30, (19,70), clip 1, 100 ms, the L4-open 26: the exit leaves a median position of 1 contract against 3 and costs +3.07 bps on the settle line, -0.40 net bps and +0.0065 USD a day against the passive wind-down -- cheaper than the recorded market close (10 contracts -7.67 bps, 50 -11.55 at 04:30) but not free
the handover a replay cannot fill --settle-residual, --settle-taker-bps, --settle-slippage-ticks prices the leftover position against the far touch plus N ticks with a taker fee and prints [SETTLE] beside [PNL]; needs one book, and off by default leaves every recorded line where it was
session --snapshot-out, --snapshot-in l2_replay only: a session is written and resumed against a replay's own clock, and ws refuses both -- a live session reconciles against the venue instead ([RECON]). See below: the account comes back, the strategy's own state does not
order leg --record-orders, --replay-orders see below: one file per venue, the reader that replays it, and the clock it replays on
live order leg --live-orders, --venue-endpoint, --venue-max-orders, --venue-orders-per-second see below: the venue becomes the relay's order channel; the first three are required together and only l2_replay and ws take them, and the rate is optional beside the session cap
signals --trend-params, --trend-entry --trend-params is the non-market-making line's EWMA cross and its exits, and --inventory-limit doubles as the size of a full signal; --trend-entry=side=own prices its clip on our own side of the book so it rests and pays the maker rate, and max_age=VIEWS cancels an entry nobody hit
threads and pacing --feed-thread, --ring-capacity, --profile-stages, --live-pacing see below: the first three report the hand-off; pacing replays against the wall clock and reports [LIVE]
paper trading --paper-broker and its five fault flags, --order-gateway and its two see below: they put a component between the strategy and the venue
execution --parent, --algo, --algo-entry needs the execution_l2 strategy
two books --symbol-b, --trades-b, --depth-b see below: one account, two venues, three extra lines

--close-out is the one flag that changes a number rather than a line: it is in the table above, and what it does to [PNL] is in what a run's numbers leave out. Its companion --close-out-cross-bps=N puts the closing IOC N basis points through the midpoint; 0, the default, is the touch every recorded run uses. A live venue needs the band because its book is not the market leg's last snapshot: a touch from a second ago can be on the wrong side of the venue's best price, and the IOC then closes nothing (no_liquidity=1). The band has an upper bound the venue enforces: the closing sell must stay above the venue's price floor, which is 0.5% under its mark. The demo's 2026-11-17 40 bps run crossed that bound -- the market leg's mid 64,250.9 against a mark of 64,368.86 put a 40 bps sell at 63,993, under the 64,047 floor, and the venue refused it; 20 bps sits at 64,122. The fill is still the venue's own best price, so the band is the ceiling spread_bps reports, not the price the exit gets.

--settle-residual is the exit a replay cannot print. Once the input ends the touch is a displayed quantity no print restores, so the closing IOC above finds no counterparty, fills nothing, and the residual is marked again -- measured on 2026-11-25, --close-out over an eight-hour window returned numbers identical to the same run without it, to the last digit of every column. The settlement prices what a session that must hand over would pay instead: the far side of the touch, --settle-slippage-ticks (default 1) further out, and --settle-taker-bps (default 5) of taker fee on the notional crossed, reported as [SETTLE] with settle_cost_usd, settle_cost_bps and the marked result with that cost taken out (settled_net_usd, settled_net_bps). It does not book a fill, so [PNL] keeps its own definition and the ledger keeps the position the run actually left -- two numbers, one definition each. A two-book run refuses it, because the two books would be settled separately and the account's line cannot say which leg would be crossed.

The eight whose semantics need more than a line

Two books. Each symbol gets its own book, decision layer, venue and pipeline, and they share one account. The four readers are merged by timestamp with ties going to the stream listed first. Three things change in what is printed: one [EXECUTION] line per book carrying symbol=, one [BOOK] line per book, and one [EXPOSURE] line for the account whose legs are valued with their own instrument's face value. [PORTFOLIO] prints once and each book prints its own [PNL] symbol=.., taken where the account's totals are written so the legs add up exactly. The broker, the gateway, --metrics, --parent, --record and --funding-rates are refused with a second book rather than applied to one of the two.

The recorder. --record=PREFIX writes PREFIX_trades.csv and PREFIX_depth.csv in the replay's own shapes, so a paced session or a live feed becomes a file this binary replays; verify_l2.sh fast records the 200k slice, replays the recording and requires every number to match. Three limits: the readers' own running ids for a snapshot and a batch are not written (the formats have no column for them), a stream that is both a snapshot and a batch -- the OKX archive -- has no single replay file and is refused, and so is any event the formats cannot express, such as a trade with no aggressor side, because a hole in a file reads back as a book that is quietly wrong.

The session snapshot. --snapshot-out writes the account, every position with its entry price and riding fee, the last midpoint per symbol, the orders the ledger holds, the clock and the next order id; --snapshot-in restores the account, asks the venue about every order the snapshot listed (a live one is cancelled, a forgotten one is counted), and replays its file from the first line while holding its own orders until the snapshot's clock. The strategy is not restored: the new process starts with the account and no memory of its own quotes, which the first fill after a resume reports as strategy_position_mismatches instead of hiding. --snapshot-in refuses --order-gateway, whose table is client state a resumed process does not have.

On a live venue the question is GET /api/v5/trade/orders-pending through the relay, so the order leg needs --order-rest; a venue that cannot answer refuses the resume instead of assuming the orders are gone. The live page has the rule and the [RESUME] line it prints.

The account's opening balance. --starting-cash=USD sets the portfolio's opening cash, the exposure ceiling [EXECUTION] reports, and the number a live run's venue-equity [RECON] compares the venue against -- at the start and again at the end. The default 1000 is the replay account. A funded demo account is why the flag exists: measured 2026-11-17, its totalEq was 80,031.54 but its USDT equity was 4,981.77 -- the rest is 1 BTC and 100 OKB in spot -- so the flag takes the USDT equity, not the total. A flat account opened at --starting-cash=4981.77 printed at=start venue_equity_usd=4981.77 ledger_equity_usd=4981.77 equity_break_usd=0.004472 status=ok. A venue that holds a position the ledger did not open is a break, not a tolerance to widen -- a flat account or a --snapshot-in is the clean start. A resumed run takes its opening cash from the snapshot instead, so --snapshot-in wins over the flag; the start line then marks the restored positions at the snapshot's own prices.

--starting-cash=venue reads the number off the account. An account that its own tests trade has a balance that moves, and this flag is not only the opening balance: it is the exposure ceiling ([EXECUTION] starting_cash_usd) and the baseline --kill-switch-loss-usd latches against, so a figure copied into a live file stops describing the account within a day. venue sends the equity query before anything is quoted and opens the ledger at the answer; a venue that does not answer, or answers a non-positive number, refuses the start rather than defaulting. What it costs is stated: the at-start [RECON] compares the venue with itself, so it is ok by construction, and the line above it says so ([RECON] baseline starting_cash_usd=... source=venue-adopted). The accounting check is therefore the at-end line, and the deployment's proof is that one, not the start.

The order leg. --record-orders=PREFIX writes <prefix>_orders.csv: one row per submission, per cancel and per execution report, in the order they happened, with every field a report carries and a price written as the shortest decimal that parses back to the same double. It is off unless named, which is what every recorded run is, and [ORDER-LOG] prints its path and its three counts so a reader can check the row count against them. A field the format cannot carry -- a symbol holding a comma -- is refused rather than escaped.

It was not a silent observer, and the defect behind that is fixed. Measured 2026-11-25, the same day and the same eight-hour window of UP-USDT-SWAP with the same frozen configuration: 123 fills and net -12.22 bps without the flag, 207 fills and net +2.71 with it, every queue counter at zero in the second. The cause was a wrapper that forwarded process_bbo and not process_l2_top: the interface's default for the L2 entry point answers the BBO one, so every L2 update reached the engine as a BBO update and the queue accounting inside MatchingEngine::process_l2_top never ran. RecordingEngine now forwards both, plus the six query methods it used to answer from the interface's defaults, and the same A/B reads 123 fills on both sides with every queue field equal. A decorator has to hand-forward every virtual, and a forgotten one changes behaviour silently -- the same failure as the wrapper that forgot on_queue_activity, one layer down -- so order_recorder_test now pins the forwards, the L2 entry point included. data/runtime/trades.csv (which every replay already writes) is still the fill record this repository reads, because it holds the fills rather than the venue's calls; its line counts match the sweep's across all seven days. The file is read back by RecordedVenue, which answers from it as an engine instead of from a venue; --replay-orders=PREFIX is the flag that makes it the run's venue, and each recorded report is released when the replay's own clock passes the timestamp it carries, so the strategy sees a fill where the session saw it rather than when it asked. A live venue's frames carry no time, so LiveVenue stamps each answer with the run's market clock; what that buys is a file whose ts column is a timeline, not a replayable stream -- a ws session through the live adapter is one realization of a wire whose answers arrive between events, and two runs of the same command have already differed in the orders they placed (the live page measures it). A replay whose market data ends first releases the rest at the end and counts them in flushed, which is the honest statement that the two inputs were not the same length. Both flags are l2_replay and ws only and both are refused on a two-book run, which has two engines; --replay-orders is also refused with --live-orders (a replay and a socket are two venues) and with --record-orders (a second file of the same answers).

What a replay cannot answer, and which sessions the round trip is exact for. RecordedVenue has no book, so the six queue queries -- queue_ahead_at, the two queue_ahead_consumed, queue_ahead_levels_cleared and queue_ahead_from_quantity_changes -- answer zero, which is exactly what a live venue answers. A live session is what this pair was built for: neither side has a book, so both read zero and the reports come back as recorded. That is the argument rather than a measurement, because the number the record used to carry ([PNL] net_pnl_usd=0.0071445 on the 200k slice) came from a simulated session -- and a recording of one no longer replays: measured 2026-11-25, it refused at line 37 of the file (order 5, 0.1635 asked against 0.1643 recorded), because the recording run's strategy read the engine's queue and the replay's has none. The refusal names the file and the line, which is this format's own rule rather than a gap. What would lift it is recording the queue queries beside the venue's answers; nothing needs that today, because fills are measured from data/runtime/trades.csv and the order leg exists to make a live session checkable.

The live order leg. --live-orders --venue-endpoint=HOST:PORT --venue-max-orders=N replaces the in-process matcher with LiveVenue over TcpVenueTransport, so the venue is the relay's order channel rather than a simulation; the run prints [VENUE] with the frames sent, the frames received and the reports decoded. The three flags are required together -- an endpoint without the opt-in reaches nothing, and a live leg with no cap of its own is the case ADR 0005 decision 4 forbids -- and both are refused outside l2_replay and ws, and on a two-book run. --venue-orders-per-second=N adds a rate beside the session cap: the cap counts the orders a whole run sends, which a maker that replaces its quotes spends in seconds, so the rest of the session is refused -- 383 quotes and 362 refusals against a twenty-order cap in one 60 s demo run -- while a rate bounds how fast the risk accumulates without ending the quoting, and a close is exempt from both. --venue-max-notional=USD adds the cap a reader can price: one order's notional, computed with fill_notional_usd, the same helper the ledger books with, so the number refused is the number the accounting would have recorded. What the venue echoes back is only an order id, so the adapter stamps the owner and the side from the order it sent: a report with no owner is a fill that was reported and never booked, and the report's default side is Buy, which would turn every sell fill into a buy. A fill's fee is the venue's own: the FILL frame's fifth field is what the venue charged on that fill, read from its fillFee and negated into the engine's sign, because the venue writes a charge as a negative number. Before that field existed every live fill arrived with fee = 0, and a live run's [PNL] was gross of a fee the venue had already taken. The role is the venue's too when it reports one: OKX's execType (M rested, T took) rides as a sixth field, and a fill the venue reports no fee for states a zero to keep the position. Without it the adapter's rule books the fill -- a Gtc order rests, so it is a maker -- which is what every live number before the field was carried was booked under. A venue that declines an add-liquidity-only quote ends the order as CANCELED <id> post_only when no cancel for it left this client, so post_only_cancels counts the venue's refusal; a refusal at placement arrives as a rejected order instead. The witness is the cancel we sent, not the order's type: until 2026-11-30 the relay labelled every cancel of a post-only order post_only, so our own re-quoting was counted as the venue's answer (the live window of 2026-11-29 read 682 of them in 738 orders, of which 679 cancels were the strategy's own). tests/live_venue_test pins those fields, the optional fee and the notional bound, and a run against the relay's simulated venue reconciles ([RECON] status=ok, no quantity break) -- by hand, not yet in the gate; the same run against the demo venue's own feed fills and reconciles, and ADR 0005 quotes it.

The feed thread. --feed-thread reads on its own thread and hands each event to the strategy thread over a bounded ring, reporting the hand-off as [LATENCY]: the ring wait, the processing, and the total, each as mean, p50, p99 and max, with the deepest the ring got and how often the feed found it full. Two ways to misread it: the figures are microseconds, so a mean below one prints as 0, and an unpaced replay reads faster than the strategy works, so the wait column is backpressure rather than the hand-off -- ring_depth_max one above the capacity says so, and the paced run is the one that measures the hand-off. A full ring is backpressure, never a lost event. --profile-stages works on this path with one block per thread; it is refused with --feed-thread on a two-book run, where one profiler would be written by two pipelines as well as the feed.

The paper broker and its faults. --paper-broker puts a broker between the strategy and the engine -- a layer a live path has and a replay does not -- and with no fault configured it forwards every call and every report, which the gate asserts by comparing a brokered run with the same run without it. The faults are counts of orders or fills rather than drawn probabilities, so a faulted run is reproducible from its command line alone. --broker-reject-every=N refuses every Nth order and counts each refusal, because a refusal emits no report — the same reason the engine carries a reject count for the pipeline to watch across a submission. --broker-partial-every=N delivers every Nth of the strategy's fills as two prints with the fee split the same way, so the position and the fee are what one print would have been and only the report count changes: on the 200k slice with --order-size=10 it split three fills, the run reported six trade reports for the same three executions, and the reconciliation stayed status=ok with a fee difference in the last bits only. --broker-drop-every=N withholds every Nth fill from the strategy while the venue's statement still records it executed. And --broker-outage-after=N with --broker-outage-holds=M takes the venue away once N orders have been accepted, holds the next M, and delivers them in submission order when the order after them arrives; a hold of zero is a venue that never comes back. A fault flag without --paper-broker is refused rather than ignored, because a fault the run cannot show would leave a faulted session looking exactly like a clean one.

The order gateway. --order-gateway puts the client's side of the order path outside the broker: it keeps a table of orders from submission to answer and reports [GATEWAY]. --gateway-ack-timeout-us=N counts an order the venue has not said anything about within N microseconds of market time, and --gateway-retry-timeouts sends it again under the same id. The venue already refuses a duplicate id, so the second copy is a refusal rather than a fill: on the 200k slice with each order held for 100 ms and a timeout of 50 ms, the gateway timed out and re-sent all six orders, the engine refused six duplicates on stderr, and the run's trades, P&L, fees and inventory were exactly those of the same run with the latency and no retry. A cancel for an order that has already finished is counted in cancels_after_fill instead of being sent to a venue with nothing to cancel. With every knob at zero the gateway forwards every call and every report, and a run with it reports the numbers of the same run without it.

The live configuration keys, rendered

The live schema's keys, their units and who may change them. python3 tools/gate/check_params.py --flags-table prints this table and --check-document refuses a page whose rows have drifted from it, so the table is rendered from config/params_schema.yaml, whose unit and authority are copied from config/param_registry.json: change the registry and regenerate the schema, not these rows. The live reader (tools/live/live_config.py) reads that same schema at run time, so the unit and the authority here are the ones a session's own allowlist enforces.

key unit authority
engine.advance_debounce_ms milliseconds AGENT_TUNABLE
engine.amend_deadband_ticks ticks AGENT_TUNABLE
engine.amend_on_toxicity switch OWNER_ONLY
engine.base_spread_ticks ticks OWNER_ONLY
engine.close_out switch OWNER_ONLY
engine.close_out_cross_bps bps OWNER_ONLY
engine.depth_ladder_max count AGENT_TUNABLE
engine.edge_cover_ticks ticks AGENT_TUNABLE
engine.extra_layers count AGENT_TUNABLE
engine.fat_finger_bps bps OWNER_ONLY
engine.inventory_limit contracts OWNER_ONLY
engine.inventory_shift_ticks ticks OWNER_ONLY
engine.kill_switch_loss_usd usd OWNER_ONLY
engine.layer_step_bps bps AGENT_TUNABLE
engine.live_orders switch SYSTEM
engine.markout_cover switch AGENT_TUNABLE
engine.max_depth_ratio ratio AGENT_TUNABLE
engine.max_exposure_usd usd OWNER_ONLY
engine.max_orders_per_second orders_per_second OWNER_ONLY
engine.min_spread_ticks ticks AGENT_TUNABLE
engine.onesided_inventory_frac ratio OWNER_ONLY
engine.order_burst count OWNER_ONLY
engine.order_size contracts OWNER_ONLY
engine.pause_bps_per_second bps_per_second AGENT_TUNABLE
engine.pause_ticks_per_second ticks_per_second AGENT_TUNABLE
engine.post_only switch OWNER_ONLY
engine.quantity_scale units_per_coin OWNER_ONLY
engine.queue_model model OWNER_ONLY
engine.quote_distance_bps bps AGENT_TUNABLE
engine.record_orders path_prefix AGENT_TUNABLE
engine.refresh_price_ticks ticks AGENT_TUNABLE
engine.reduce_only_exit switch AGENT_TUNABLE
engine.settle_residual switch AGENT_TUNABLE
engine.skew_limit contracts AGENT_TUNABLE
engine.starting_cash venue_or_usd OWNER_ONLY
engine.strategy line OWNER_ONLY
engine.symbol instrument_id OWNER_ONLY
engine.wind_down_adverse_bps bps OWNER_ONLY
engine.wind_down_end hhmm_utc OWNER_ONLY
engine.wind_down_skew_minutes minutes OWNER_ONLY
engine.wind_down_skew_ticks ticks OWNER_ONLY
engine.ws_seconds seconds AGENT_TUNABLE
link.cancel_latency_us microseconds AGENT_TUNABLE
link.market_endpoint host_port SYSTEM
link.order_latency_us microseconds AGENT_TUNABLE
link.snapshot_out path SYSTEM
link.venue_endpoint host_port SYSTEM
link.venue_max_notional usd AGENT_TUNABLE
link.venue_max_orders count OWNER_ONLY
link.venue_orders_per_second orders_per_second AGENT_TUNABLE