Guide

How to backtest 0DTE options on real quotes

0DTE options expire the day they trade, so their prices move fast and their spreads matter. A backtest built on daily prices or a pricing model misses most of that. Retro backtests same-day options on the real bid and ask of every minute, with history back to 2022.

What Retro's option history holds

  • SPY and QQQ contracts that expire the same day, near the money.
  • SPX (SPXW) and XSP, the cash-settled index options.
  • The real bid and ask of each minute. A buy fills at the ask and a sale at the bid, as it would in the market.
  • Only what was known then. The strike list holds the contracts listed by the simulated time, so it grows through the day.

What to get right

  • The spread. A same-day option can lose a large share of its price to the spread on the way in and out. Fills at the bid and ask count that, and a test at the mid-price doesn't.
  • The open. Options aren't quoted before the bell, so a pass at 9:30:00 finds no prices and the next one does.
  • The close. Retro closes nothing for your program. A contract still held at the close leaves the account at what it was worth then, and SPX and XSP contracts settle in cash against the index's official close. Decide in code whether the strategy holds to the bell or gets out first.
  • Size. A 0DTE contract can go to zero in an afternoon. Size each trade as a share of the account you can lose in full.
  • What isn't there yet. A backtest has no Greeks, option bars or option trades. Work from the quotes and the underlying's price.

An example to start from

Describe the strategy to Claude with the details that matter for same-day options:

  • “Write a program that buys same-day SPY calls on a breakout. Show me the chain first, and keep each trade to 3% of its money.”
  • “Backtest it over the last two months and show me the five worst trades.”

Claude reads the chain, writes the program and backtests it on Retro's history. You can also write it yourself in Programs. How to build a trading bot with AI covers connecting Claude, and how to backtest a trading strategy covers reading the result.

What you need

Option backtests come with Retro Data, a monthly subscription on the data page. Without it, a backtest's option requests are refused and its result says how many were. Stock and ETF backtests are free.

More guides