Iron-Butterfly — 0DTE Specialist Engine

Python 0DTE Iron Butterfly signal engine
Regime + implied-move sizing, hold-to-expiry take-profit
Paper-trading only — outputs to Discord and structured event payloads

Overview

Iron-Butterfly trades a same-day (0DTE) Iron Butterfly on index products: sell the at-the-money call and put (the body) and buy protective wings at ±width. It sizes each day from a fused view of the realized morning range and the option-implied expected move, then holds to expiry to keep the full credit — with a hard stop if the trade goes badly against it.

It is a paper-trading research tool, not a brokerage or a trade recommendation. No live orders are placed.

Sizing — fuse three signals, size to the weakest

SignalMeaning
ORfirst-hour high−low (the realized morning move)
ADRaverage daily range over the last N days (the "normal" day)
EMthe ATM 0DTE straddle at entry (the implied remaining-day move)

Ratios drive the tiering: or_ratio = OR/ADR, em_ratio = EM/width, iv_rv = EM/ADR. A hard breach gate skips the day when the implied move is too large for the wings (em_ratio ≥ 1). Size is the minimum of the range-tier and the implied-move tier, and a low iv_rv (implied < realized) trims a full size to a half. One entry per day, taken after the opening regime window forms.

Structure and management

Session lifecycle

The bot posts a session-start message once at launch, trades the day's regime window, settles any open 0DTE at the close, then goes dormant until the next trading day's regime-forming hour — refreshing its data token on wake. A --settle-open mode force-settles and records any open position off the underlying.

Configuration

FlagPurpose
--tickersindex symbol(s), e.g. SPX
--widthwing width
--full-sizecontracts at full tier
--regime-window / --range-lookbackopening-range minutes / ADR days
tier thresholdsOR and EM tier cutoffs
--broker / --broker-fallbackdata source (schwab, yfinance)
--state-tagisolates a run's book and rolls it up separately
--discordDiscord webhook target

Outputs

Disclaimer

For educational and paper-trading research only. Not financial advice. 0DTE options carry substantial, fast-moving risk of loss.

← About