05Research
Toxic flow starts with a model of your bot
Each of seventeen attack classes on a market maker needs one specific condition. Attackers find it by modelling how the bot reacts, and the defender can check every condition before launch.
What toxic flow is
Order flow is toxic, in the words of Easley, López de Prado and O'Hara, "when it adversely selects market makers, who may be unaware they are providing liquidity at a loss."1 Glosten and Milgrom showed in 1985 that informed traders alone create a spread: the market maker recovers what it loses to them from everyone else.2
Speed adds a second source. In a continuous order book, Budish, Cramton and Shim showed, even public information that everyone sees at once creates arbitrage profits for the fastest, and those profits harm liquidity provision.3 In the largest UK stocks, latency-arbitrage races made up about 20% of trading volume, and removing them would cut the cost of liquidity by an estimated 17%.4
The framework our red team hands over splits toxic flow into two families. Adverse flow, which includes sniping and trading on news the quote has not absorbed, is legal and gets priced. Manipulative flow, which includes spoofing, quote stuffing, momentum ignition and fake volume, is prohibited and gets stopped.
It starts with a recording
Before an attack, someone studies the bot. They record the order book and the bot's public trades, send a few small orders, and build a model of how it reacts: how quickly it moves its quotes, how far its prices lean as inventory builds, when and where it hedges. If that model predicts the bot, an attack is possible. None of it needs inside access.
Seventeen attacks, one condition each
The table lists the attack classes a pre-launch red team works through.
| Attack | What it does | The condition that makes it possible |
|---|---|---|
| Latency sniping | Hits a quote left stale after the lead venue jumps | The bot reacts to a jump on the lead venue more slowly than others |
| Informed flow | Trades on news that has already moved the asset elsewhere | The asset moves first on another venue when news lands |
| Spoofing against the fair price | Shows orders it means to cancel, then trades against the shifted quote | The fair price uses visible depth |
| Quote stuffing and API limits | Floods the book until the bot's cancels slow down or are refused | On a busy day the bot reaches the venue's cancel or rate limits |
| Probing | Sends tiny orders to learn how the bot responds | The bot changes its behaviour after tiny fills |
| Bias harvesting | Trades ahead of the bot's next price | An outsider can predict that price |
| Volatility games | Makes the local market look calmer or wilder than it is | The bot measures volatility only on the local venue |
| Momentum ignition | Starts a move the bot follows, then trades against it | The bot follows the local price |
| Inventory squeeze | Takes more from one side than the bot holds | The bot's inventory is smaller than a credible demand spike |
| Hedge front-running | Trades ahead of the bot's hedge | The bot's hedging is predictable and the hedge venue is thin |
| Large sweeps | Takes the bot's full size on one side at once | The size per side exceeds what the hedge venue can absorb |
| Reference manipulation | Moves a thin source to move the bot's reference | One thin source can move the median |
| Fake volume | Inflates a source's reported volume to raise its weight | Source weights depend on reported volume |
| Deposit or withdrawal suspensions | Trades against the bot where transfers have stopped and prices drift | The bot does not read wallet and deposit status |
| Opening attacks | Trades against the first quotes, before a reliable price exists | The bot starts without a reference, or at full size |
| Rival hedging | Another firm unloads its own risk onto the bot's quotes | The bot is the slowest or cheapest book for that firm |
| Logic failures | Steers the bot into a rare losing state | A rare state exists in which the bot buys high and sells low |
Why it matters at launch
A new book is public from its first quote. Most of the conditions are set before launch: the reference's sources and weights, where and how the bot hedges, the size it shows, whether it reads wallet status, and how it opens. Each can be checked before the first order. After launch, every fix is made while the book trades.
Building the model first
Before launch, the defender can do the same work against a simulated market with an attacking agent in it. Published research goes further. At IJCAI 2020, Spooner and Savani trained a market maker against an adversary that learns, standing in for traders who want to profit at the market maker's expense. The market maker became risk-averse without being given constraints or penalties, and performed better whether or not the adversary was present in testing.5
Two checks carry most of the weight
The fingerprint test asks whether an outsider, with public data only, can predict the bot's next move. If it can, the reconnaissance above has already worked. Shadow mode runs the bot on live data without sending orders, and logs every fill it would have had, each judged toxic or not. It can start on other venues before the launch venue's book exists.
Testing within the law
Several rows describe conduct the law treats as manipulation. Section 4c(a)(5)(C) of the US Commodity Exchange Act makes spoofing, "bidding or offering with the intent to cancel the bid or offer before execution", unlawful on the markets the Act regulates.6 Article 12 of the EU Market Abuse Regulation counts as manipulation orders that overload the order book, or that send a false or misleading signal, in particular by starting or exacerbating a trend.7 Article 91 of MiCA prohibits market manipulation in crypto-assets and names the same kinds of orders.8
Every test Onchain Bureau runs is authorized in writing by the venue or firm tested. Any pattern that would be manipulation on a live market, including spoofing, layering, quote stuffing, wash trades and momentum ignition, runs only in a sandbox or on a testnet.
What Onchain Bureau sells
Onchain Bureau makes markets on exchanges and onchain, and runs a toxic flow red team: authorized adversarial testing of an exchange's, a market maker's or a trading algorithm's own systems, plus a framework the client runs to score and ban accounts sending toxic order flow. Findings go to the client privately.
This note stops at the conditions. If you are preparing a launch, every one of them can be checked before your bot sends its first order: book a pre-launch toxic flow red team, or talk to us.
Sources
- David Easley, Marcos M. López de Prado and Maureen O'Hara, "Flow Toxicity and Liquidity in a High-frequency World", The Review of Financial Studies 25(5), 2012, pp. 1457 to 1493. Read 3 November 2026. doi.org/10.1093/rfs/hhs053 (opens in a new tab)
- Lawrence R. Glosten and Paul R. Milgrom, "Bid, ask and transaction prices in a specialist market with heterogeneously informed traders", Journal of Financial Economics 14(1), 1985, pp. 71 to 100. Read 3 November 2026. doi.org/10.1016/0304-405X(85)90044-3 (opens in a new tab)
- Eric Budish, Peter Cramton and John Shim, "The High-Frequency Trading Arms Race: Frequent Batch Auctions as a Market Design Response", The Quarterly Journal of Economics 130(4), 2015, pp. 1547 to 1621. Read 3 November 2026. doi.org/10.1093/qje/qjv027 (opens in a new tab)
- Matteo Aquilina, Eric Budish and Peter O'Neill, "Quantifying the High-Frequency Trading 'Arms Race'", The Quarterly Journal of Economics 137(1), 2022, pp. 493 to 564. Read 3 November 2026. doi.org/10.1093/qje/qjab032 (opens in a new tab)
- Thomas Spooner and Rahul Savani, "Robust Market Making via Adversarial Reinforcement Learning", Proceedings of IJCAI-20, 2020, pp. 4590 to 4596. Read 3 November 2026. www.ijcai.org/proceedings/2020/633 (opens in a new tab)
- US Commodity Exchange Act section 4c(a)(5)(C), 7 U.S.C. 6c(a)(5)(C), spoofing. Read 3 November 2026. www.law.cornell.edu/uscode/text/7/6c (opens in a new tab)
- Regulation (EU) No 596/2014 (Market Abuse Regulation), Article 12, market manipulation. Read 3 November 2026. www.legislation.gov.uk/eur/2014/596/article/12/adopted (opens in a new tab)
- Regulation (EU) 2023/1114 (MiCA), Article 91, prohibition of market manipulation, ESMA Interactive Single Rulebook. Read 3 November 2026. esma.europa.eu, MiCA Article 91 (opens in a new tab)