anchor-demo / options trader bot

Options trader bot

It buys a same-day (0DTE) SPY option on Interactive Brokers when SPY breaks out of its first 15 minutes. Safe by default: no orders until you set a stop and a target, and paper only unless you add --live.

What it does

  1. Takes the high and low of the first 15 minutes.
  2. CALL when SPY goes $0.30 above that range, PUT when $0.30 below.
  3. Buys today's option about $1.50 out of the money, sized to its budget ($100 to start).
  4. Leaves the stop and target at IB, and logs each trade to a CSV.
  5. Stops for the day after two losses in a row.

All 13 steps, and what can go wrong

Fixed from the original

  • Bought a contract it could not afford.
  • Read the wrong bar as the opening range.
  • Kept trading on a made-up $100 when the balance failed to load.
  • Switched to tomorrow's expiry, which is not 0DTE.
  • Crashed when no strike was near, and used the PC's clock instead of New York's.

Every change

Checked against its spec

The light loop held it to 19 rules from its written spec and proved 3 faults: a wrong strike on a tie, an in-the-money buy, and a log row lost on Ctrl+C. All three are fixed.

How the light loop checks

Tested

84 tests, and they caught all 30 bugs planted to test them. The trading-day tests run against a fake TWS, so no test can reach a real account.

What the tests cover

Replayed on a real week

SPY's real minute bars for November 2 to 6, 2026, with $100 and test exits: it traded on Monday and Wednesday, and the budget ended at $35.40. On the other three days the option cost more than the budget left. Option prices are modeled, not real quotes.

Watch it

How others do it

  • Hugging Face has no model or dataset for this strategy.
  • QuantConnect picks same-day expiries and strikes by delta, and trades options through IB.
  • Opening-range research trades shares; one 0DTE version sells spreads instead of buying.
  • Retail traders lost about $70 million on 0DTE index options in 2021 to 2023.
  • One 0DTE study's profits vanished once trading spreads were charged in full.

Sources, and how this bot differs

Open questions

  1. Is there more of the original script?
  2. What stop and target?
  3. What is TIME_STOP_PCT for?
  4. Trade again the same day after a trade?
  5. Is the 15-minute breakout the trend read you mean?
  6. Option too dear for the budget: go further out, or skip?
  7. Carry the budget day to day, or reset to $100?

The questions in full