Research question

How much short-horizon edge does order flow carry?

Order-flow imbalance can anticipate small price moves. Measuring that edge properly means replaying it through realistic execution delays and an explicit fee hurdle.

01 · Method

I replay one four-hour BTC/ETH order-book capture across two evaluation phases, four horizons, and nine delay combinations, with a fixed 4 bp fee.

02 · Conclusion

Order flow carries a positive gross edge in 110 of 144 execution scenarios.

The best gross edge reaches 2.39 bp, measured against a fixed 4 bp taker fee; lower-cost execution is the next test.

Scope of the evidence. Exploratory simulation · research reference only · not live trading. The 144 scenarios overlap and are not independent experiments or a portfolio to add together.

03 · Direct evidence

See what supports the finding.

Open interactive Space ↗

Gross edge across 144 scenarios

Each dot is one fee-and-latency scenario · dashed line marks the fixed 4 bp fee

Gross edge across 144 scenarios

What this shows. Each dot is one scenario’s gross edge per unit of turnover, sorted from lowest to highest; 110 of 144 are above zero and the best reaches 2.39 bp. The dashed line marks the fixed 4 bp taker fee. Overlapping scenarios must not be summed.

View exact values & source
SymbolPhaseHorizonDecision delay (events)Order delay (events)Gross edge (bp)
ETHUSDTreplication_testclock_5000ms00-4.768465
ETHUSDTreplication_testclock_5000ms01-4.768465
ETHUSDTreplication_testclock_5000ms05-4.768465
ETHUSDTreplication_testclock_5000ms10-4.768465
ETHUSDTreplication_testclock_5000ms11-4.768465
ETHUSDTreplication_testclock_5000ms15-4.768465
ETHUSDTreplication_testclock_5000ms50-4.768465
ETHUSDTreplication_testclock_5000ms51-4.768465
ETHUSDTreplication_testclock_5000ms55-4.768465
BTCUSDTreplication_testevent_2055-0.31103
BTCUSDTreplication_testevent_2005-0.310029
BTCUSDTreplication_testevent_2050-0.310029
BTCUSDTreplication_testevent_2015-0.308846
BTCUSDTreplication_testevent_2051-0.308846
BTCUSDTreplication_testevent_2011-0.303881
BTCUSDTreplication_testevent_2001-0.299964
BTCUSDTreplication_testevent_2010-0.299964
BTCUSDTreplication_testclock_1000ms55-0.286797
BTCUSDTreplication_testclock_1000ms05-0.259468
BTCUSDTreplication_testclock_1000ms50-0.259468
BTCUSDTreplication_testclock_1000ms15-0.256589
BTCUSDTreplication_testclock_1000ms51-0.256589
BTCUSDTreplication_testevent_2000-0.255473
BTCUSDTreplication_testclock_1000ms11-0.24959
BTCUSDTreplication_testclock_1000ms01-0.240947
BTCUSDTreplication_testclock_1000ms10-0.240947
BTCUSDTreplication_testclock_1000ms00-0.216151
ETHUSDTreplication_testevent_2055-0.024026
ETHUSDTreplication_testclock_1000ms55-0.018949
ETHUSDTreplication_testevent_2015-0.004938
ETHUSDTreplication_testevent_2051-0.004938
ETHUSDTreplication_testevent_2005-0.001744
ETHUSDTreplication_testevent_2050-0.001744
ETHUSDTprimary_testevent_10055-0.001706
ETHUSDTreplication_testclock_1000ms150.000657
ETHUSDTreplication_testclock_1000ms510.000657
ETHUSDTreplication_testclock_1000ms050.004368
ETHUSDTreplication_testclock_1000ms500.004368
ETHUSDTprimary_testevent_100150.011531
ETHUSDTprimary_testevent_100510.011531
ETHUSDTprimary_testevent_100050.015032
ETHUSDTprimary_testevent_100500.015032
ETHUSDTreplication_testevent_20110.019916
ETHUSDTprimary_testevent_100110.025154
ETHUSDTreplication_testclock_1000ms110.028872
ETHUSDTprimary_testevent_100010.029896
ETHUSDTprimary_testevent_100100.029896
ETHUSDTreplication_testevent_20010.036258
ETHUSDTreplication_testevent_20100.036258
ETHUSDTprimary_testevent_100000.036961
ETHUSDTreplication_testclock_1000ms010.046746
ETHUSDTreplication_testclock_1000ms100.046746
ETHUSDTreplication_testevent_20000.062076
ETHUSDTreplication_testclock_1000ms000.075435
BTCUSDTreplication_testclock_5000ms550.078329
BTCUSDTreplication_testclock_5000ms150.082302
BTCUSDTreplication_testclock_5000ms510.082302
BTCUSDTreplication_testclock_5000ms050.084506
BTCUSDTreplication_testclock_5000ms500.084506
BTCUSDTreplication_testclock_5000ms110.094273
BTCUSDTreplication_testclock_5000ms010.101917
BTCUSDTreplication_testclock_5000ms100.101917
BTCUSDTreplication_testclock_5000ms000.118346
ETHUSDTreplication_testevent_100550.121997
ETHUSDTreplication_testevent_100150.136646
ETHUSDTreplication_testevent_100510.136646
ETHUSDTreplication_testevent_100050.140423
ETHUSDTreplication_testevent_100500.140423
BTCUSDTprimary_testclock_1000ms050.142462
BTCUSDTprimary_testclock_1000ms500.142462
BTCUSDTprimary_testclock_1000ms150.142669
BTCUSDTprimary_testclock_1000ms510.142669
BTCUSDTprimary_testclock_1000ms010.146384
BTCUSDTprimary_testclock_1000ms100.146384
BTCUSDTprimary_testclock_1000ms000.147068
BTCUSDTprimary_testclock_1000ms110.147101
BTCUSDTprimary_testclock_1000ms550.147879
ETHUSDTreplication_testevent_100110.154275
ETHUSDTreplication_testevent_100010.162785
ETHUSDTreplication_testevent_100100.162785
ETHUSDTreplication_testevent_100000.174813
BTCUSDTprimary_testevent_100550.179269
BTCUSDTprimary_testevent_100150.186457
BTCUSDTprimary_testevent_100510.186457
BTCUSDTprimary_testevent_100050.188205
BTCUSDTprimary_testevent_100500.188205
BTCUSDTprimary_testclock_5000ms550.189379
BTCUSDTreplication_testevent_100550.192134
BTCUSDTprimary_testclock_5000ms050.193769
BTCUSDTprimary_testclock_5000ms500.193769
BTCUSDTprimary_testclock_5000ms110.194084
BTCUSDTprimary_testclock_5000ms150.194109
BTCUSDTprimary_testclock_5000ms510.194109
BTCUSDTprimary_testclock_5000ms010.197025
BTCUSDTprimary_testclock_5000ms100.197025
BTCUSDTprimary_testevent_100110.197133
BTCUSDTreplication_testevent_100150.197349
BTCUSDTreplication_testevent_100510.197349
BTCUSDTreplication_testevent_100050.199901
BTCUSDTreplication_testevent_100500.199901
BTCUSDTprimary_testevent_100010.202454
BTCUSDTprimary_testevent_100100.202454
BTCUSDTprimary_testclock_5000ms000.207923
BTCUSDTprimary_testevent_100000.213716
BTCUSDTreplication_testevent_100110.215372
BTCUSDTreplication_testevent_100010.223938
BTCUSDTreplication_testevent_100100.223938
BTCUSDTreplication_testevent_100000.238146
ETHUSDTprimary_testevent_20050.382312
ETHUSDTprimary_testevent_20110.382312
ETHUSDTprimary_testevent_20500.382312
ETHUSDTprimary_testevent_20150.38366
ETHUSDTprimary_testevent_20510.38366
BTCUSDTprimary_testevent_20050.383941
BTCUSDTprimary_testevent_20150.383941
BTCUSDTprimary_testevent_20500.383941
BTCUSDTprimary_testevent_20510.383941
BTCUSDTprimary_testevent_20550.384298
ETHUSDTprimary_testevent_20010.385906
ETHUSDTprimary_testevent_20100.385906
ETHUSDTprimary_testevent_20550.392195
BTCUSDTprimary_testevent_20110.394186
BTCUSDTprimary_testevent_20010.395237
BTCUSDTprimary_testevent_20100.395237
BTCUSDTprimary_testevent_20000.421172
ETHUSDTprimary_testevent_20000.474321
ETHUSDTprimary_testclock_1000ms050.643476
ETHUSDTprimary_testclock_1000ms110.643476
ETHUSDTprimary_testclock_1000ms500.643476
ETHUSDTprimary_testclock_1000ms150.645684
ETHUSDTprimary_testclock_1000ms510.645684
ETHUSDTprimary_testclock_1000ms010.649366
ETHUSDTprimary_testclock_1000ms100.649366
ETHUSDTprimary_testclock_1000ms550.659672
ETHUSDTprimary_testclock_1000ms000.834689
ETHUSDTprimary_testclock_5000ms002.385231
ETHUSDTprimary_testclock_5000ms012.385231
ETHUSDTprimary_testclock_5000ms052.385231
ETHUSDTprimary_testclock_5000ms102.385231
ETHUSDTprimary_testclock_5000ms112.385231
ETHUSDTprimary_testclock_5000ms152.385231
ETHUSDTprimary_testclock_5000ms502.385231
ETHUSDTprimary_testclock_5000ms512.385231
ETHUSDTprimary_testclock_5000ms552.385231

Source: assets/data/microstructure_backtest_reference.json

Download figure (SVG)

Gross edge is positive at every horizon

Gross-positive scenarios out of 36 per horizon

Gross edge is positive at every horizon

What this shows. At least 22 of 36 scenarios are gross-positive at each horizon, and 35 of 36 at the 100-event horizon. This is one four-hour exploratory capture, not a test of live profitability or cross-day reliability.

View exact values & source
HorizonGross-positive scenariosTotal scenarios
20 events2236
100 events3536
1 second2636
5 seconds2736

Source: assets/data/microstructure_backtest_reference.json

Download figure (SVG)
Research notes

Design, sources & limitations

What I built

I built the leakage-safe signal-to-execution path with frozen assumptions, auditable scenarios, and checksummed artifacts.

110 / 144gross-positive before fees
2.39 bpbest gross edge
144fee and latency scenarios
0.14 bpmedian gross edge
Market microstructureTime-series MLExecution simulationReproducible research

Research question

When do order-flow imbalance, liquidity, and limit-order-book conditions predict short-horizon price movement—and which claims survive data-quality and execution gates?

Predictability, executability, and profitability are separate questions. The project makes event ordering, temporal leakage, gaps, fees, latency, uncertain fills, adverse selection, and inventory risk explicit before a claim can be promoted.

Execution stress test

Exploratory simulation · research reference onlyNonconfirmatory · not live trading
Gross-positive110 / 144Before fees
Best gross edge2.39 bpBefore fees
Frozen fee4.00 bpAll scenarios
Median gross edge0.14 bpBefore fees
110 gross-positiveup to 2.39 bp gross edge4 bp fee hurdle
Predefined default scenarioBTCUSDT · primary pseudo-heldout · 1 second
d1 / o1
Gross P&L+$0.82
Gross edge+0.15 bp
Turnover$55,406
Fee hurdle4.00 bp
Orders32,541
Fills546
Fill ratio1.68%

Research reference only. One deterministic four-hour market-order simulation; not live trading. The two adjacent pseudo-heldout phases are neither prospectively untouched nor cross-day replication. The 144 scenarios overlap and must not be summed.

Open the bounded result JSON.

v2.0 Fee & Queue-Position Re-Pricing of the 144 Market-Order Scenarios (exploratory)

Execution TierFee (bp)Adverse Selection (bp)Effective Hurdle (bp)Gross > 0Net > 0 (of 144)Best Net Edge (bp)Median Net Edge (bp)
Retail Taker (Frozen Baseline)4.000.004.001100-1.6148-3.8555
VIP-9 Taker1.500.001.501109+0.8852-1.3555
Maker 0 bp (Tail-of-Queue)0.001.851.851109+0.5352-1.7055
Maker 0 bp (Median-Queue)0.001.151.151109+1.2352-1.0055
Maker 0 bp (Front-of-Queue)0.000.450.4511019+1.9352-0.3055
Maker Rebate -0.50 bp (Median-Queue)-0.501.150.6511011+1.7352-0.5055

How to read this table. Each row subtracts a different hurdle (fee plus an assumed adverse-selection cost) from the gross edge of the same 144 deterministic market-order scenarios; no passive order was simulated, and the assumed fill probabilities (0.42–0.74) are not applied to any figure. “Best net edge” is the maximum over 144 overlapping scenarios minus the hurdle, with no multiple-testing adjustment. That maximum (2.3852 bp gross) comes from nine latency variants of one ETHUSDT primary-phase 5-second scenario with 10 fills, so +1.9352 bp is a selected single-session observation, not an achievable maker edge.

Earlier trade-only protocol terminal

This separate, earlier M8 study remains a valid NOT_RUN terminal. It should not be confused with the later nonconfirmatory continuous L2 pilot summarized above.

StageRows inspectedWarningsOutcome
BTCUSDT training2,071,4610Normalization passed.
ETHUSDT training987,29753The predeclared zero-warning gate failed.
Model selection0—Not started.
Held-out evaluation0—Dates were not opened.

The valid terminal is INSUFFICIENT_DATA. It is evidence that the protocol stopped correctly—not evidence for or against a market hypothesis. Execution and P&L remain NOT_RUN.

Capabilities demonstrated

  1. Preserve exchange and receipt ordering with explicit continuity epochs.
  2. Construct features only from information observable at the decision point; labels begin strictly afterward.
  3. Use purged, embargoed, time-ordered model selection and prediction-only evaluation.
  4. Carry predictive diagnostics through fees, latency, fills, adverse selection, inventory, and liquidation assumptions.
  5. Freeze checksummed run bundles and generate reports from artifacts instead of copying preferred metrics into prose.

Public data boundary

The public GitHub and Dataset packages contain source code, configuration, tests, protocols, and documentation. They do not redistribute exchange observations, normalized or derived events, fitted states, ingestion authorities, or generated run bundles. The website and Space expose one machine-generated, low-dimensional 144-scenario summary with checksummed provenance; it contains no raw events, ledgers, models, or local paths. Users obtain public market data independently under provider terms.

Reproduce and inspect

Run make setup, make check, and make reproduce-sample for the deterministic synthetic vertical slice. Synthetic output verifies software behavior only. The public exploratory summary was generated from a checksum-verified local bundle, not hand-copied into this page.

Limitations

  • The current result uses one continuous four-hour capture and deterministic market-order assumptions.
  • Its adjacent evaluation phases reuse overlapping source data; there is no prospectively untouched or cross-day confirmation.
  • The 144 latency, horizon, symbol, and phase scenarios are alternatives, not positions in a portfolio.
  • No result is a live-trading, significance, capacity, profitability, annualized-return, or investment claim.