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

Option Strategies

Long Iron Condor

Introduction

The Long 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, where B>underlying price
-1 near-OTM put C, where C<underlying price
1 far-OTM put D, where CD=AB

The long iron condor consists of buying a far OTM call, buying a far OTM put, selling a near ATM call, and selling a near ATM put. This strategy profits from an decrease in price movement (implied volatility) and time decay since ATM options decay sharper.

Implementation

Follow these steps to implement the long 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 long 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
        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]
  5. In the on_data method, place the orders.
  6. Approach A: Call the OptionStrategies.iron_condor method with the details of each leg and then pass the result to the buy method.

    Select Language:
    iron_condor = OptionStrategies.iron_condor(
        self._symbol, 
        far_put.strike,
        near_put.strike,
        near_call.strike,
        far_call.strike,
        expiry)
    
    self.buy(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=(CfarT+PfarTCnearTPnearTCfar0Pfar0+Cnear0+Pnear0)×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 long iron condor

The maximum profit is the net credit received after commission when opening the trade, where KPOTM<ST<KCOTM.

The maximum loss is KCfarKCnear+Cnear0+Pnear0Cfar0Pfar0, where KPOTM>ST or 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.85857.50
Far-OTM put3.80815.00
Near-OTM call1.65852.50
Near-OTM put3.50820.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+000+1.65+3.501.853.80)×1001×4=54

So, the strategy loses $54.

The following algorithm implements a long iron condor Option strategy:

Select Language:
class LongIronCondorOptionStrategy(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]

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

        self.buy(iron_condor, 2)

Other Examples

For more examples, see the following algorithms:

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: