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
| Signal | Meaning |
|---|---|
| OR | first-hour high−low (the realized morning move) |
| ADR | average daily range over the last N days (the "normal" day) |
| EM | the 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
- Entry — sell ATM call + ATM put (body), buy call/put wings at ±
--width. - Stop — cost-to-close ≥ 2× credit (i.e. −100% of premium).
- Take profit — hold to expiry; if it settles inside the wings, keep the full credit.
- Expiry settlement — settled at intrinsic value; if the option chain is no longer quotable after the close, it settles off the underlying's last price so a position is never left open.
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
| Flag | Purpose |
|---|---|
--tickers | index symbol(s), e.g. SPX |
--width | wing width |
--full-size | contracts at full tier |
--regime-window / --range-lookback | opening-range minutes / ADR days |
| tier thresholds | OR and EM tier cutoffs |
--broker / --broker-fallback | data source (schwab, yfinance) |
--state-tag | isolates a run's book and rolls it up separately |
--discord | Discord webhook target |
Outputs
- Discord — session-start card, entry card (strikes, credit, sizing rationale), and a close card (reason, P&L).
- Structured events — ENTRY/EXIT payloads so realized P&L rolls up into the daily-summary dashboard, tagged by
--state-tag.
Disclaimer
For educational and paper-trading research only. Not financial advice. 0DTE options carry substantial, fast-moving risk of loss.
← About