The Backtest Library

Great investing books,
re-run as programs.

Every month, we take one rule from an investing classic, write it as a program, and publish the backtest. You get to see how the idea actually held up — not just how well it was argued.

1
Rule per issue
1 mth
Publishing cycle
10 yrs
Test window per idea

Latest issue

The newest entry in the crate.

BL — 001

Peter Lynch on the peg ratio rule

One Up on Wall Street · 1989 · 18 min read

Tested

Lynch argued that a stock is cheap when its price-to-earnings ratio is below its growth rate. That single comparison became one of the most quoted rules in retail investing. We wrote it as a program and ran it over a decade of US large caps.

The rule, as written

Rank every US stock by PEG = PE / growth, but only inside the fast-grower window: three-year earnings growth of 20–25% a year. Buy the cheapest end, equal weight, rebalance on the first trading day of each month. Six thresholds were run from no filter through PEG 0.5.

Setup
  • Period: 2012 – 2024 (13 years)
  • Universe: Top 3,000 US stocks by dollar volume
  • Rebalance: Monthly, first trading day
  • Positions: Equal weight, 6 to 100+ names by threshold
  • Benchmark: S&P 500 at 14.5% a year
  • Engine: QuantConnect LEAN, point-in-time data

Every issue, the same three steps

The format is fixed so issues stay comparable over time.

Read

One book, one idea

Each issue isolates a single rule an author actually stated — not the whole book, not a vague philosophy. One rule, quoted and pinned down.

Write

Turned into a program

The rule is translated into explicit code: universe, entry condition, position sizing, exit. Every assumption is written down so you can disagree with it.

Run

Tested on real data

The program runs over a decade of market data across hundreds of names. Results are published as they came out, including the ones that did not work.

One book, one program, every month

Join the list and get each new issue the day it is published.