book
Checkout our new book! Hands on AI Trading with Python, QuantConnect, and AWS Learn More arrow

Option Strategies

Short Iron Butterfly

Introduction

The Short Iron Butterfly is an option strategy which involves four Option contracts. All the contracts have the same underlying stock and expiration, but the order of strike prices for the four contracts is A>B>C. The following table describes the strike price of each contract:

PositionStrike
1 OTM call A
-1 ATM call B
-1 ATM put B
1 OTM put C=B(AB)

The short call butterfly consists of buying an OTM call, buying an OTM put, selling an ATM call, and selling an ATM put. This strategy profits from an increase in price movement (implied volatility) and from time decay value since ATM options decay sharper.

Implementation

Follow these steps to implement the short iron butterfly strategy:

  1. In the initialize method, set the start date, end date, cash, and Option universe.
  2. Select Language:
    def initialize(self) -> None:
        self.set_start_date(2017, 4, 1)
        self.set_end_date(2017, 5, 10)
        self.set_cash(100000)
    
        self.universe_settings.asynchronous = True
        option = self.add_option("GOOG", Resolution.MINUTE)
        self._symbol = option.symbol
        option.set_filter(lambda universe: universe.include_weeklys().iron_butterfly(30, 5));

    The iron_butterfly filter narrows the universe down to just the four contracts you need to form a short iron butterly.

  3. In the on_data method, select the contracts in the strategy legs.
  4. Select Language:
    def on_data(self, slice: Slice) -> None:
        if self.portfolio.invested:
            return
    
        # Get the OptionChain
        chain = slice.option_chains.get(self._symbol, None)
        if not chain:
            return
    
        # Select expiry
        expiry = max([x.expiry for x in chain])
    
        # Separate the call and put contracts
        calls = [i for i in chain if i.right == OptionRight.CALL and i.expiry == expiry]
        puts = [i for i in chain if i.right == OptionRight.PUT and i.expiry == expiry]
        if not calls or not puts:
            return
    
        # Get the ATM and OTM strike prices
        atm_strike = sorted(calls, key = lambda x: abs(chain.underlying.price - x.strike))[0].strike
        otm_put_strike = min([x.strike for x in puts])
        otm_call_strike = 2 * atm_strike - otm_put_strike
  5. In the on_data method, select the contracts and place the orders.
  6. Approach A: Call the OptionStrategies.short_iron_butterfly method with the details of each leg and then pass the result to the buy method.

    Select Language:
    short_iron_butterfly = OptionStrategies.short_iron_butterfly(self._symbol, otm_put_strike, atm_strike, otm_call_strike, expiry)
    self.buy(short_iron_butterfly, 2)

    Approach B: Create a list of Leg objects and then call the combo_market_order, combo_limit_order, or combo_leg_limit_order method.

    Select Language:
    # Select the contracts
    atm_call = [x for x in calls if x.strike == atm_strike][0]
    atm_put = [x for x in puts if x.strike == atm_strike][0]
    otm_call = [x for x in calls if x.strike == otm_call_strike][0]
    otm_put = [x for x in puts if x.strike == otm_put_strike][0]
    
    legs = [
        Leg.create(atm_call.symbol, 1),
        Leg.create(atm_put.symbol, 1),
        Leg.create(otm_call.symbol, -1),
        Leg.create(otm_put.symbol, -1)
    ]
    self.combo_market_order(legs, 1)

Strategy Payoff

The short iron butterfly is a limited-reward-limited-risk strategy. The payoff is

COTMT=(STKCOTM)+CATMT=(STKCATM)+POTMT=(KPOTMST)+PATMT=(KPATMST)+PT=(CATMT+PATMTCOTMTPOTMTCATM0PATM0+COTM0+POTM0)×mfee whereCOTMT=OTM call value at time TCATMT=ATM call value at time TPOTMT=OTM put value at time TPATMT=ATM put value at time TST=Underlying asset price at time TKCOTM=OTM call strike priceKCATM=ATM call strike priceKPOTM=OTM put strike priceKPATM=ATM put strike pricePT=Payout total at time TCOTM0=OTM call value at position opening (credit received)CATM0=ATM call value at position opening (debit paid)POTM0=OTM put value at position opening (credit received)PATM0=ATM put value at position opening (debit paid)m=Contract multiplierT=Time of expiration

The following chart shows the payoff at expiration:

Strategy payoff decomposition and analysis of short iron butterfly

The maximum profit is KCOTMKCATMCATM0PATM0+COTM0+POTM0. It occurs when the underlying price is below the OTM put strike price or above the OTM call strike price at expiration.

The maximum loss is the net debit paid, COTM0+POTM0CATM0PATM0. It occurs when the underlying price stays the same as when you opened the trade.

If the Option is American Option, there is a risk of early assignment on the contracts you sell.

Example

The following table shows the price details of the assets in the algorithm:

AssetPrice ($)Strike ($)
OTM call2.35855.00
OTM put2.75810.00
ATM call8.10832.50
ATM put7.40832.50
Underlying Equity at expiration843.25-

Therefore, the payoff is

COTMT=(STKCOTM)+=(843.25855.00)+=0CATMT=(STKCATM)+=(843.25832.50)+=10.75POTMT=(KPOTMST)+=(810.00843.25)+=0PATMT=(KPATMST)+=(832.50.00843.25)+=0PT=(COTMT+POTMTCATMTPATMTCOTM0POTM0+CATM0+PATM0)×mfee=(0+010.7502.352.75+8.10+7.40)×1001×4=39

So, the strategy losses $39.

The following algorithm implements a short iron butterfly Option strategy:

Select Language:
class ShortButteflyOptionStrategy(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2017, 4, 1)
        self.set_end_date(2017, 4, 23)
        self.set_cash(100000)
        
        option = self.add_option("GOOG", Resolution.MINUTE)
        self._symbol = option.symbol

        # set our strike/expiry filter for this option chain
        option.set_filter(lambda x: x.include_weeklys().iron_butterfly(30, 5))

    def on_data(self, slice: Slice) -> None:
        if self.portfolio.invested:
            return

        # Get the OptionChain
        chain = slice.option_chains.get(self._symbol, None)
        if not chain:
            return

        # Select expiry
        expiry = max([x.expiry for x in chain])

        # Separate the call and put contracts
        calls = [i for i in chain if i.right == OptionRight.CALL and i.expiry == expiry]
        puts = [i for i in chain if i.right == OptionRight.PUT and i.expiry == expiry]
        if not calls or not puts:
            return

        # Get the ATM and OTM strike prices
        atm_strike = sorted(calls, key = lambda x: abs(x.strike - chain.underlying.price))[0].strike
        otm_put_strike = min([x.strike for x in puts])
        otm_call_strike = 2 * atm_strike - otm_put_strike

        short_iron_butterfly = OptionStrategies.short_iron_butterfly(self._symbol, otm_put_strike, atm_strike, otm_call_strike, expiry)
        self.buy(short_iron_butterfly, 1)

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: