The short version
- Learning traders that compete with each other behave well. They make markets, quote slightly tighter spreads than classic strategies, and never trip a manipulation detector.
- Learning traders that share one reward run a pump-and-dump. Four "team" learners learned, on their own, to push the price up to 5% above its true value and crash it, every 60 to 80 rounds, taking around 110,000 per episode from each type of market maker. Competing learners never do this.
- The result survived every control I could think of: mixing learners from different training runs, a deeper order book, learners strong enough to move prices alone, and four different market-maker reaction rules. It needs the shared reward, and market makers whose reaction to order flow has no upper bound.
- No learner ever spoofed, not even in a version of the market built so that spoofing pays.
- How you pay a learner decides whether it manipulates. My first reward valued wealth at the market price; the learner cornered the market and walked the price from 1,007 to 4,283. It looked like a 3.95 million profit, and was a loss of 47,000 to 84,000 at the true value.
1The question
More and more trading is done by programs that learn from experience. Such a program is told only one thing: make as much profit as you can. Nobody tells it what is forbidden.
So what does it learn? Does it find spoofing, wash trading or a pump-and-dump on its own? Do several of them learn to collude? And when regulators add rules, does the bad behaviour stop, or just change shape?
You can't answer this on a real exchange: the experiments would be illegal, and you can't rerun history. So I built a simulated exchange, filled it with traders from the research literature, checked it against real market data, and put learning agents into it.
The project has two phases:
- Phase 1, no rules: what do learning traders do, and what happens to the market? complete
- Phase 2, regulation: cancellation fees, circuit breakers and position limits. Does the behaviour vanish, change shape, or does the rule damage the market? in progress
2The simulated market
The exchange is a limit order book with price-time priority, the same matching rule most real exchanges use. Prices are whole numbers of ticks and the engine is deterministic: the same seed reproduces a run bit for bit. Tests check that no shares or money are ever created or destroyed.
Around the book trade 46 traders:
- 12 market makers running the classic strategies of repeated-game theory (Tit-for-Tat, Generous Tit-for-Tat, Grim Trigger, Win-Stay-Lose-Shift). Each one quotes both sides, manages its inventory, and moves its quotes when order flow is unusually one-sided, the way real dealers infer information from flow.
- 30 background traders after Chiarella, Iori and Perelló (2009). Each mixes four views: the price should return to value, trends continue, the visible order book predicts the next move, and noise. The book readers matter: they are the audience a spoofer needs to fool.
- 4 seats for learners. When I need a baseline, fixed market makers fill the same seats on the same random seeds.
A hidden true value drives everything. It follows a random walk with no trend and with calm and stormy spells (stochastic volatility). Nobody sees it; every trader gets a noisy hint.
Is it realistic enough?
I compared the simulator with a day of real order-book data for Intel, Microsoft and Apple (LOBSTER, 21 June 2012). Without tuning for it, it matched the order life cycle: about 9 in 10 orders are cancelled unfilled (real 91–92%, simulated 89%).
Two features had to be calibrated in, and both were tested on fresh data afterwards:
- Price impact. A 400-unit order moves the price 5.95 ticks; the empirical square-root law predicts 6.1.
- Volatility clustering. It lands inside the range of real trading days.
The first volatility calibration passed on 8–16 test markets and then failed to replicate on 24 new ones, because one very stormy market had dominated the averages. Redoing it properly is one of the reasons I trust the rest.
Finally, six crisis scenarios exist for stress tests: a 3% news jump, forced sales of 400 or 800 units, and each of these with market makers pulling their quotes. In the worst one, 19% of markets stay damaged for the rest of the episode.
3The learners
Each learner is a small neural network trained with PPO (two hidden layers of 64 units, one network per learner).
- What it sees: 36 numbers. These are five levels of the order book on each side, the spread, recent price changes and volatility, net buying on the tape, its own position and orders, the same value hint the market makers get, and a clock.
- What it does: each round it picks one of 972 actions: where to place a bid and an ask (or not), how big each is (1, 5 or 25 units), and whether to send a market order. That is enough to express honest market making, but also large decoy orders, one-sided pushing and trading with yourself.
The reward was the hardest design decision
| Reward | What happened |
|---|---|
| Wealth valued at the market price | The learner manipulated the price it was valued at: it cornered the market, walked its own quotes from 1,007 to 4,283 while the true value stayed near 1,010, and traded with itself. On paper: up to +3.95 million. At the true value: −47,000 to −84,000. Same in all three training runs. |
| Wealth valued at the true value | No learning at all. Almost all of each round's wealth change is "position × random value move", which is pure noise. |
| Realized edge | Learning within about 200 episodes. |
Realized edge scores each trade the moment it happens, against the true value at that moment. Because the true value has no trend, this has exactly the same expected value as real profit, with far less noise, and there is nothing the learner can push to inflate it. A unit test checks the identity.
That first failure became one of the project's findings: a reward that depends on a price the agent can move invites manipulation. Foscari et al. (2025) prove a version of the same thing in theory.
With realized edge, one learner earns +327 to +355 per episode more than the average classic strategy, winning about 97% of episodes, without any manipulation.
4How every result was produced
I treated this like a lab science, because simulations make it easy to fool yourself:
- Pre-registration. Every hypothesis, measure and pass/fail rule was written down and dated before the run. When I had to change something, I wrote a dated addendum and left the original untouched.
- Three independent training runs per setting. A result counts only if it holds in at least 2 of 3.
- Fresh evaluation seeds never used in training, in the calm market and in all six crises.
- A paired baseline. Fixed market makers sit in the same seats on the same seeds, and results are compared episode by episode with bootstrap confidence intervals.
- Manipulation detectors, then tracing every flag by hand in the order book.
Six cheating detectors
The hard part of detecting manipulation is that honest traders also cancel most of their orders. A detector is useful only if it catches cheaters and leaves honest traders alone. I built six (spoofing, wash trading, cornering, momentum ignition, marking the close, collusion). Each was validated against scripted cheaters and thousands of honest traders before it was used on a learner.
Tracing turned out to matter. The spoofing detector did flag some learners. When I traced the flagged orders, they were ordinary quotes replaced every round, with no push on the price. So these were false positives, and I documented them as a known blind spot of the measure.
5Results
5.1 Five kinds of learner, one outlier
I trained five variants, four learners each, three runs each:
- Standard
- realized edge, no limits.
- Fair
- the same limits as the market makers (50-unit position cap, no market orders).
- Risk-averse
- penalised for large positions.
- Settlement
- also paid on a closing price that could be pushed.
- Team
- every learner receives the average reward of all four.
- Self-interested learners keep the market healthy. The price stays about 1 tick from value, as it does with fixed market makers, and they quote tighter spreads than the classic strategies. There is no sign of collusion.
- The fair learner still beats the classic strategies, by about +100 to +125 per seat per episode, mostly by trading better against background traders.
- Settlement learners don't mark the close, although it would pay.
- The team is the outlier: its price sits 13–16 ticks from value, and its spread is 5–9 ticks wider than the standard learners'.
5.2 The team's pump-and-dump
The episode at the top of this page shows it. Tracing the team's trades showed how it works:
- All four buy with market orders. The market makers read the one-sided buying as information and raise their quotes.
- The raised quotes trade against the team's resting sell orders, above the true value.
- The price is let go; it falls below value, and the cycle restarts every 60 to 80 rounds.
- The roles are divided. Two seats hold large long positions, one is short, one does little, and the team trades 10,000 to 22,000 units per episode among itself, which costs nothing under a shared reward.
No single-account detector fires. Momentum ignition looks for one trader who pushes and then reverses. Here the pushing and the profiting are done by different accounts.
5.3 Is it real? Four controls
A striking result invites the question of whether it's an artefact. I pre-registered four controls before looking:
| Worry | Control | Result |
|---|---|---|
| Is it a habit of partners who trained together? | Cross-play: swap half the team for learners from another run | Survives in 6 of 6 mixes, keeping 51–92% of the price distortion |
| Is it a thin-book effect? | Deeper book: 2–3× the market makers, or 2–4× their quote size | Survives (7–17 ticks); deeper books even made the market makers more exploitable |
| Is it just four accounts' combined size? | Capacity: learners with 4× bigger market orders, able to move prices alone | One strong learner or four strong competing ones barely move the price (0–0.8 ticks). Cooperation is needed |
| Is it the market makers' trigger rule? | Four reaction rules for the market makers | Below |
The claim that survives: learners that share a reward discover a coordinated pump-and-dump against liquidity providers that react to order flow without bounding the reaction, and per-account surveillance doesn't see it.
The caveat I always state: the fixed market makers never adapt. A real dealer farmed like this would widen its spread or stop trading. So the existence of the strategy, and the fact that only cooperating learners find it, is a real result about this market. Its size reflects how naive the market makers are.
5.4 Why nobody spoofs
No learner was ever confirmed spoofing. I wanted to know whether that's because spoofing doesn't pay here, or because learning can't find it.
First, does it pay? A hand-written spoofer, compared with an identical honest copy, makes money in a simpler version of the market. In the realistic one it loses. Adding the ingredients one at a time pins down the cause: stormy volatility. When the price swings a lot, it runs through the decoy order more often, and the decoy gets filled exactly when the price is moving against it.
Then, can learning find it when it does pay? I built a variant with calm volatility, longer days and 50-unit quotes, where the scripted spoofer earns +187 per episode, and trained learners in it. They used the big quote size, but only as ordinary quotes replaced every round. Spoofing in 0 of 3 runs.
Likely reasons: a decoy must be held in place for several rounds while the learner trades on the other side, but these learners re-optimise every round and have no memory; and +187 is small next to the ~2,000 they earn by ordinary market making. A learner with memory (as in Byrd, 2022) might find it.
5.5 More learners, slightly worse market
With one learner, the market is slightly better than with fixed market makers. As learners are added it degrades steadily, and with eight it is about 0.3 ticks worse on spread. The direction holds in all three runs, but the effect is small. A lone learner quotes a little wider than the classic strategies (market power, not collusion), and the premium disappears as learners compete.
6Engineering
- Own engine instead of an existing simulator (ABIDES). I needed full control of every rule for Phase 2, several learners acting at exactly the same moment, and speed. The exchange itself was the easy part; making manipulation possible and valuing wealth so it can't be gamed were the hard parts.
- Every market mechanism was forced by a failure. Examples:
- trend-followers fed on themselves until prices overflowed, so beliefs are now bounded;
- a forced seller of 800 units moved the price by nothing, so market makers now read order flow;
- the first market drifted upward and the learner simply bought and held, so the value now has no trend.
- Telemetry and replay. Every order, trade and book state can be logged. A test proves that logging doesn't change the market, and another that the book can be rebuilt from the log alone. A standalone browser viewer replays any episode.
- Throughput on a laptop. Training runs 8 copies of the market in parallel and resumes after interruptions. A graphics card wouldn't help: the networks are tiny and most of the time goes to simulating the market.
7What I learned
- Incentives are the experiment. The same algorithm became a manipulator, a market maker or a cartel depending only on how it was paid.
- Look at the order book, not the summary statistics. My first "success" was a learner cornering the market; the profit number looked great. Every real finding here came from tracing individual orders.
- Write down the test before you run it. Pre-registration caught a false success and a calibration that didn't replicate. Without it, I would have reported both.
- Null results need two levels of explanation. "No spoofing" meant little until I showed both that it doesn't pay in this market and that learners still don't find it where it does.
8Limitations
- The market makers don't adapt. That's the main reason the team's profits are so large.
- Simple learners. Standard PPO with default settings and no memory: chosen to represent off-the-shelf learning, not the best a trading firm could build. The "no" results hold within this budget and action space.
- One asset, a coarse tick, a very lively market. The simulated market moves about 15% per "day", where the real stocks moved 2–4%.
- Some follow-ups rest on one training run (the market-maker rule comparison). More runs are planned.
9What's next: regulation
Phase 2 adds rules as switchable modules and retrains the learners under each:
- a cancellation fee, per cancel or above an order-to-trade ratio;
- a circuit breaker, as a trading halt or as a price band;
- position limits.
Each rule's strength is varied to trace the trade-off between stability and liquidity. The team's pump-and-dump is a ready-made test case: does a halt or a position limit stop it, and what does that cost honest traders?