A Two-Agent Process for Researching and Trading SPY Iron Condors
Summary
This document describes an options workflow that separates candidate research from trading and risk decisions. A research agent identifies and documents a specific four-contract iron condor. A second agent independently checks the option chain, contract legs, quotes, package price, and account risk; it alone may submit the atomic multi-leg order and then verify the order and resulting positions. The strategy policy sets the underlying, delta, days to expiration, wing width, exits, and risk limits, while reusable options mechanics and active runtime rules inform agent calls.
The document reports a seven-day backtest that opened one SPY condor and ended near flat with a small maximum drawdown, while emphasizing that the short window demonstrates mechanics rather than expected performance. It also says other recent windows produced no trade when historical option-chain data was unavailable. A separate evaluation checks chain retrieval and order-handling steps using a fixture. A later short simulation opened 38 condors and ended with the package still open. These examples illustrate workflow and execution checks, not a reliable estimate of strategy returns; results depend on data availability and remain limited to short simulations.
Key ideas
- The workflow assigns candidate discovery and order execution to separate agents.
- The trading and risk agent rechecks all four legs, pricing, and account exposure before submitting an order.
- Only the final agent can place the atomic multi-leg order and verify the resulting positions.
- The reported short backtests and simulation illustrate mechanics, not expected returns.
- Missing historical option-chain data can appropriately result in no trade.
Tags
Full text
# agents example ai iron condor AI Iron Condor ============== .. meta:: :description: ai_iron_condor.py is a two-agent options strategy. A research-only agent finds and documents an exact four-contract candidate. .. image:: ../docs/assets/ai-agent-workflows/ai-iron-condor.png :alt: AI iron-condor workflow using LumiBot runtime skills, rules, tools, and execution :width: 100% ``ai_iron_condor.py`` is a two-agent options strategy. A research-only agent finds and documents an exact four-contract candidate. A dedicated trading-and-risk agent independently rechecks the chain, prices and sizes the package, and is the only agent allowed to place a broker order. The system prompt contains only the strategy policy: underlying, delta, DTE, wing width, exits, and risk limits. Reusable options mechanics are supplied by LumiBot's built-in ``options-trading`` skill. Active ``rules.json`` entries are loaded again before every agent call and appended to the runtime instructions. The example uses ``openai/gpt-6-luna`` on medium reasoning, the default. Existing saved strategies keep the model identifier already stored in their code. How it works ------------ * The research agent reads the underlying, chain, contracts, Greeks, and quotes. * The trading-and-risk agent independently verifies the exact four legs and account risk. * Only that final agent prices and submits the atomic broker order. * It verifies the returned order and current signed positions before reporting state. Verified backtest evidence -------------------------- The preserved ``2026-08-05_00-33_9dcawc`` seven-day backtest opened one atomic SPY iron condor with the 685/690 put spread and 771/776 call spread, all using a single 2026-09-04 expiration. The backtest ended near flat with a -0.00% rounded total return and a -0.08% maximum drawdown. This short window proves mechanics, not expected performance. The refactored strategy was also rerun over two current seven-day windows. The active downloader reported no historical option chain, so the agent correctly made no trade instead of inventing contracts. The release-gated real-model eval provides a chain fixture and separately verifies chain retrieval, four valid legs, explicit package pricing, one atomic submission, and post-submit state verification. Run a seven-day backtest ending today with an options-capable backtest data source: .. code-block:: bash export OPENAI_API_KEY="your-key" export BACKTESTING_DATA_SOURCE="alpaca" export DATADOWNLOADER_BASE_URL="https://<your-downloader-host>:8080" export DATADOWNLOADER_API_KEY="your-downloader-key" python -m lumibot.example_strategies.ai_iron_condor Set ``BACKTESTING_START`` and ``BACKTESTING_END`` in ``YYYY-MM-DD`` format to choose an exact historical window. The latest run used ``openai/gpt-6-luna`` on high reasoning with Alpaca option history from January 5 to 15, 2026. On January 5 it opened 38 SPY February 13 iron condors (645/650 puts and 715/720 calls) at real Alpaca prices through ``orders_submit_multileg``, sized to the risk budget. The account ended at $99,734 with the package still open. This is one short simulation, not a performance claim. .. literalinclude:: ../lumibot/example_strategies/ai_iron_condor.py :language: python :linenos:
Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.