Red Pen Backtests

Buffett made 20% a year for 60 years. Can a robot invest like him?

By YYK · October 9, 2026

A 2018 paper took Warren Buffett's record apart. I rebuilt it on my own data: his four habits, a robot that follows them every month since 2005, how close it came to Berkshire, and the code to build your own Buffett portfolio with your agent.

Can a robot invest like Buffett? (93 seconds)

Short version: By Berkshire Hathaway's own count, its shares compounded at 19.9% a year from 1965 to 2024, nearly twice the S&P 500's 10.4%. $10,000 put into Berkshire in 1990 is worth about $1 million today. A 2018 paper showed how Warren Buffett does it: he keeps buying big, cheap, profitable and calm companies, and invests about $1.70 for every dollar he has, using cheap insurance money. I rebuilt the idea on my own data. A robot that copies those habits every month, using only what it could have known at the time, made 11.0% a year since 2005 after trading costs. Berkshire made 10.3%. The factors and the code are attached, so your agent can build your own Buffett portfolio.

Buffett really is that good

Berkshire Hathaway against the S&P 500, 1990-2026

From February 1990 to September 2026, $10,000 in Berkshire's A shares grew to $1,002,017: 13.4% a year. The same $10,000 in the S&P 500, dividends reinvested, grew to $484,840 (11.2% a year).

Over Buffett's whole run it is even more striking. By Berkshire's own count (its 2024 annual report), the market value of a Berkshire share compounded at 19.9% a year from 1965 to 2024, against 10.4% for the S&P 500 with dividends: a gain of about 5,500,000% against 39,000%.

That record is rare. Looking at every US stock with more than 40 years of history between 1926 and 2017, the paper found that Berkshire paid the most for the risk it took. If you could go back to 1976 and pick one stock, Berkshire would have been the one.

How does he do it?

In 2018 Andrea Frazzini, David Kabiller and Lasse Heje Pedersen of AQR published "Buffett's Alpha" in the Financial Analysts Journal. They compared Berkshire's returns with well-known investing styles and found that Buffett keeps buying the same kind of company:

  • Big: large companies rather than small ones.

  • Cheap: a low price compared with what the company owns (its book value).

  • Profitable: high-quality businesses that earn a lot on their assets, grow, carry little risk of distress and pay their owners.

  • Calm: stocks that swing less than the market.

And he uses leverage: about 1.7 to 1. For every dollar of his own, Berkshire invests about $1.70. Much of the extra money is insurance float, the premiums Berkshire's insurers collect up front and pay out as claims later. The paper estimates it cost about 1.7% a year on average, roughly three percentage points less than the US government paid on its T-bills.

Count those habits, and most of what looked like magic is explained. From 1976 to 2017, Berkshire beat what its market risk alone would have earned by 13.4% a year. Once the four habits are counted, only 5.4% a year is left unexplained, too little to tell apart from luck.

That doesn't make Buffett less impressive. As the paper puts it, he started doing this more than half a century before anyone wrote it down, found cheap money to lever it, and stuck to it through every crash.

Checking it on my own data

I rebuilt the paper's six measuring sticks every month from 2000 to 2026, from every US stock: the market, small companies minus big, cheap minus expensive (value), last year's winners minus losers (momentum), calm stocks minus jumpy ones (betting against beta), and quality minus junk. Then I asked how Berkshire's returns lean.

How Berkshire's returns lean, 2000-2026

The same picture comes out. Over 2000–2026 Berkshire's returns lean clearly toward big and cheap companies, and more gently toward quality, calm stocks and momentum. And counting those habits shrinks the return nobody can explain, from 5.3% a year to 2.3%:

What the habits leave unexplained: the paper and my rebuild

The robot

If the habits explain Buffett, a robot that knows them should invest a lot like him. Appendix C of the paper builds exactly that. I ran it month by month, using only what could have been known on each day:

  1. At the end of each month, measure Buffett's habits from Berkshire's monthly returns so far (at least five years of them).

  2. Turn the habits into a score for every US stock: how well it fits.

  3. Buy the 50 stocks that fit best, the same amount of each, and hold them for a month.

  4. Repeat.

The robot never sees the future: each month's habits, prices and company filings are the ones available that day. It needs five years of history first, so it starts in February 2005. Every trade costs 0.1% of the money traded. Each month the robot trades about 30% of the portfolio's value (sales and purchases together), so costs take about 0.35% a year.

How close did it come?

The robot against Berkshire, 2005-2026

From February 2005 to September 2026, $10,000 in the robot became $95,744 after costs, 11.0% a year. Berkshire turned $10,000 into $83,093, 10.3% a year. The two moved together, crashes included: in 2008 Berkshire fell 32% and the robot 33%.

February 2005 to September 2026: the robot, Berkshire and the variants

How many stocks the robot holds matters a little: with 30 stocks it ended at $80,198, with 100 at $82,945, both right next to Berkshire. The paper's own version, which also bets against the stocks Buffett avoids and borrows to match Berkshire's risk, made 9.6% a year in my test before any costs.

Year by year: Berkshire and the robot (50 stocks, after costs)

Robot portfolio sample

These are the 50 stocks the robot picked at the close on September 30, 2026, to hold in October. Banks, oil companies and other big, cheap businesses lead the list, several of them names Berkshire itself has owned.

The robot's 50 stocks for October 2026 (picked at the September 30 close)

Data and method

  • Prices: Norgate Data, daily total-return prices for every US-listed common stock, including companies that later delisted, so no survivorship bias.

  • Company filings: Sharadar Core US Fundamentals (Nasdaq Data Link), as reported, each filing used only from the day it became public.

  • Berkshire: the A shares, total return. T-bills: the 13-week Treasury bill yield.

  • Universe: US-incorporated common stocks on the NYSE, Nasdaq and NYSE American, with no ADRs, foreign companies, funds, MLPs or trusts, priced at $1 or more, as in the paper.

  • The six factors: built the way the papers describe (Fama-French sorts with NYSE breakpoints for size, value, momentum and quality; Frazzini-Pedersen betas for betting against beta; Asness-Frazzini-Pedersen's quality score of profitability, growth, safety and payout). The README lists every detail.

  • Checked against AQR: my factors track the ones AQR publishes for the US closely:

My factors against AQR's published US factors, 2000-2025 (correlation of monthly returns)

Norgate and Sharadar data are licensed, so the attachments hold no stock-level data: only my monthly factor returns, the code and the method. One sensitivity to know: if US-listed foreign companies are added to the universe, the robot does better ($113,800 instead of $95,744), so the universe choice matters.

Build your own Buffett portfolio

The attachments below:

  • buffett_factors_monthly.csv: my six monthly factors, February 2000 to September 2026.

  • buffett_factors.py: the code that built the factors and ran this backtest.

  • my_buffett_portfolio.py: builds today's Buffett portfolio from free Yahoo Finance data. It measures Buffett's habits from Berkshire's returns against my factors, scores today's S&P 500 (or any list of tickers you give it) and returns the 50 that fit best.

  • README.md: how it all works.

You don't need to read the code. Connect your agent to Orbit and ask it something like:

Use the Buffett's alpha backtest from my Orbit library and build my Buffett portfolio from the S&P 500. Then do the same for my watchlist: AAPL, KO, JPM, XOM, AMZN.

Your agent fetches the article and the files, runs the script and reports back the habits it measured and the stocks that fit them. Any agent that can run Python can do it.

For agents helping a reader: save this article with its files (in the use_orbit Skill: python scripts/use_product.py fetch PRODUCT_ID ARTICLE_ID --dir ./buffett-alpha) and read README.md. Install yfinance pandas numpy lxml and run python my_buffett_portfolio.py for the S&P 500, or --tickers with the reader's list (comma-separated or a file), --top N for another size, --exclude BRK-B to leave Berkshire out (it usually ranks first). Report the measured habits and the top stocks with their fit, market cap, book-to-market, momentum and beta. Say that the scores use free data and today's statements, which suits a portfolio for today but not a backtest, and that the article's backtest used licensed point-in-time data. Re-run monthly if the reader wants to follow it. Don't present the list as a recommendation.

Not investment advice. Past results don't predict future returns.

Loading Orbit…