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

Option Strategies

Short Iron Condor

Introduction

The Short Iron Condor is an Option strategy that consists of four contracts. All the contracts have the same underlying Equity and expiration, but the order of strike prices is A>B>C>D. The following table describes the strike prices of each contract:

PositionStrike
-1 far-OTM call A
1 near-OTM call B,whereB>underlying price
1 near-OTM put C,whereC<underlying price
-1 far-OTM put D,whereCD=AB

The short iron condor consists of selling a far OTM call, selling a far OTM put, buying a near OTM call, and buying a near OTM put. This strategy profits from a increase in price movement (implied volatility).

Implementation

Follow these steps to implement the short iron condor 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, 2, 1)
        self.set_end_date(2017, 3, 1)
        self.set_cash(500000)
    
        self.universe_settings.asynchronous = True
        option = self.add_option("GOOG")
        self._symbol = option.symbol
        option.set_filter(lambda universe: universe.include_weeklys().iron_condor(30, 5, 10))

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

  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[self._symbol.underlying].invested:
            self.liquidate()
    
        if self.portfolio.invested or not self.is_market_open(self._symbol):
            return
    
        chain = slice.option_chains.get(self._symbol)
        if not chain:
            return
    
        # Find put and call contracts with the farthest expiry       
        expiry = max([x.expiry for x in chain])
        chain = sorted([x for x in chain if x.expiry == expiry], key = lambda x: x.strike)
    
        put_contracts = [x for x in chain if x.right == OptionRight.PUT]
        call_contracts = [x for x in chain if x.right == OptionRight.CALL]
    
        if len(call_contracts) < 2 or len(put_contracts) < 2:
            return
    
        # Select the strategy legs
        far_put = put_contracts[0]
        near_put = put_contracts[1]
        near_call = call_contracts[0]
        far_call = call_contracts[1]
  5. In the on_data method, place the orders.
  6. Approach A: Call the OptionStrategies.short_iron_condor method with the details of each leg and then pass the result to the buy method.

    Select Language:
    short_iron_condor = OptionStrategies.short_iron_condor(
        self._symbol, 
        far_put.strike,
        near_put.strike,
        near_call.strike,
        far_call.strike,
        expiry)
    
    self.buy(short_iron_condor, 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:
    legs = [
        Leg.create(far_put.symbol, -1),
        Leg.create(near_put.symbol, 1),
        Leg.create(far_call.symbol, -1),
        Leg.create(near_call.symbol, 1)
    ]
    self.combo_market_order(legs, 1)

Strategy Payoff

This is a limited-reward-limited-risk strategy. The payoff is

CfarT=(STKCfar)+CnearT=(STKCnear)+PfarT=(KPfarST)+PnearT=(KPnearST)+PT=(CnearT+PnearTCfarTPfarTCnear0Pnear0+Cfar0+Pfar0)×mfee
whereCfarT=Far OTM call value at time TCnearT=Near OTM call value at time TPfarT=Far OTM put value at time TPnearT=Near ATM put value at time TST=Underlying asset price at time TKCfar=Far OTM call strike priceKCnear=Near OTM call strike priceKPfar=Far OTM put strike priceKPnear=Near OTM put strike pricePT=Payout total at time TCfar0=Far OTM call value at position opening (credit received)Cnear0=Near OTM call value at position opening (debit paid)Pfar0=Far OTM put value at position opening (credit received)Pnear0=Near OTM 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 condor

The maximum profit is KCfarKCnearCnear0Pnear0+Cfar0+Pfar0, where KPOTM>ST or ST>KCOTM.

The maximum loss is the net debit paid: Cfar0+Pfar0Cnear0Pnear0, where KPOTM<ST<KCOTM.

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 ($)
Far-OTM call1.05857.50
Far-OTM put2.15815.00
Near-OTM call2.75852.50
Near-OTM put4.80820.00
Underlying Equity at expiration843.25-

Therefore, the payoff is

CfarT=(STKCfar)+=(843.25857.50)+=0CnearT=(STKCnear)+=(843.25852.50)+=0PfarT=(KPfarST)+=(815.00843.25)+=0PnearT=(KPnearST)+=(820.00843.25)+=0PT=(CnearT+PnearTCfarTPfarTCnear0Pnear0+Cfar0+Pfar0)×mfee=(0+0002.754.80+1.05+2.15)×1001×4=439

So, the strategy loses $439.

The following algorithm implements a short iron condor Option strategy:

Select Language:
class ShortIronCondorOptionStrategy(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_condor(30, 5, 10))

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

        chain = slice.option_chains.get(self._symbol)
        if not chain:
            return

        # Find put and call contracts with the farthest expiry       
        expiry = max([x.expiry for x in chain])
        chain = sorted([x for x in chain if x.expiry == expiry], key = lambda x: x.strike)

        put_contracts = [x for x in chain if x.right == OptionRight.PUT]
        call_contracts = [x for x in chain if x.right == OptionRight.CALL]

        if len(call_contracts) < 2 or len(put_contracts) < 2:
            return

        # Select the strategy legs
        near_call = call_contracts[0]
        far_call = call_contracts[1]
        near_put = put_contracts[1]
        far_put = [x for x in put_contracts if x.Strike == near_put.strike - far_call.strike + near_call.strike][0]

        short_iron_condor = OptionStrategies.short_iron_condor(
            self._symbol, 
            far_put.strike,
            near_put.strike,
            near_call.strike,
            far_call.strike,
            expiry)

        self.buy(short_iron_condor, 2)

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: