Rasmus Suonio

Nine reinforcement-learning traders, and none beat buy and hold

A trading environment with realistic costs, nine RL algorithms, a full baseline suite and a holdout evaluated once. The controls work; the agents add nothing.

Done Nov 2026
SPY 2007–18 Sharpe, agents vs buy and hold
0.19–0.53 vs 0.41
Holdout 2019–26, evaluated once
Buy and hold 0.77; agents 0.67 to −0.52
Best of 72 strategies vs buy and hold
Information ratio −0.03
One leaky feature on a random walk
Sharpe 6.9
  • Python
  • PyTorch
  • NumPy
  • Optuna
Out-of-sample Sharpe ratios of nine RL agents on SPY, 2007–2018, after all costs, with wide 95% intervals spanning buy and hold's 0.41.

Any reinforcement-learning (RL) agent can be made to produce a good backtest. The question here is whether RL adds anything over simple, well-understood strategies once execution is realistic and the evaluation is honest. On daily data the answer was no: none of nine algorithms beat simple strategies out of sample, and nothing, rule or agent, beat holding SPY on returns.

How it works #

  • The environment. An agent decides at the close and fills at the next open, paying a tick-size spread, slippage, square-root market impact, commission, a participation cap, financing and short borrow. Every baseline goes through the same environment and pays the same costs.
  • Nine algorithms, all in PyTorch: tabular Q-learning, DQN, Double DQN, A2C, PPO, SAC, TD3, Moody–Saffell recurrent RL and PPO-LSTM. Each was first checked on problems with known answers.
  • Controls before conclusions. Synthetic markets with a planted edge, a pure random walk, and an “oracle” feature that reveals the next day’s return.
  • Honest evaluation. Six walk-forward folds on SPY, a 2019–2026 holdout evaluated once with every access logged, seed ensembles with bootstrap intervals, and deflated Sharpe ratios that count all 72 strategies tried. The Sharpe ratio is annualised excess return over volatility.

What I found #

  • The controls pass. PPO, A2C and recurrent RL find planted edges (test Sharpe 0.64–1.19), no agent beats chance on a random walk, and all nine reach a Sharpe of 12–14 with the oracle, so the implementations work.
  • SPY, 2007–2018. The agents score 0.19–0.53 against buy and hold’s 0.41, with no significant difference, and all trail a 50/200-day moving-average trend filter (0.61). Across all 72 strategies, the best information ratio against buy and hold is −0.03. Higher Sharpe ratios came from holding less risk in 2008, not from earning more.
  • Holdout, 2019–2026. Buy and hold scores 0.77; the RL configurations 0.67 down to −0.52. The development ranking reversed (rank correlation −0.63): the best development agents were among the worst.
  • More assets did not help: on nine ETFs the best agent’s 0.52 trails minimum variance’s 1.09.
Mean test Sharpe of PPO with one leaky feature added, on a random walk and on SPY
Mean test Sharpe of PPO with one leaky feature added, on a random walk and on SPY

The lessons about method travel further than the null result:

  • Validation does not predict test. Across 162 runs, the validation Sharpe of the chosen checkpoint had almost no relation to the next two years’ test Sharpe, and training to the end beat validation-selected checkpoints for six of nine algorithms. A hyperparameter search bought nothing out of sample.
  • Leakage beats every algorithm. One feature built from a centred moving average, which sees ten days ahead, turns a random walk into a Sharpe of 6.9 and fools validation just as much.
  • Turnover is the hidden variable. High-turnover agents lose half their Sharpe by about $20 million of capital, even in SPY.
  • Reward hacking appears in mild forms. Drawdown penalties collapse exposure while the Sharpe ratio survives, and a risk stop without a penalty invites more risk.

Audit and limits #

An independent audit of the code found no look-ahead, but nine real problems in data, costs and statistics, such as fictitious futures roll jumps and hindsight in a stock list. All were fixed and earlier runs re-scored. Writing the report exposed one more: a policy that never trades had a Sharpe ratio made of rounding noise, which had steered the first hyperparameter search towards doing nothing. The metric was fixed and the search repeated.

The data is daily bars from a free source, with no intraday or order-book data, and the cost parameters are generic rather than broker quotes. With two or three seeds per configuration and twelve years of test data, differences below about 0.3 Sharpe cannot be resolved.

How it’s built #

A Python package with a vectorised numpy environment (about 17,000 steps a second per core), PyTorch agents, a baseline suite, Optuna search and a training dashboard. Every run records its config, seed, environment version and code fingerprint. 23 tests cover exact P&L accounting, execution timing, costs, short-sale bans and causality, including a check that catches four deliberately leaky features.