---
title: "Short Iron Condor"
description: "The Short Iron Condor is an Option strategy that consists of four contracts where the order of strike prices is A>B>C>D."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/option-strategies/short-iron-condor
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/option-strategies/short-iron-condor.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/22%20Trading%20and%20Orders/08%20Option%20Strategies/18%20Short%20Iron%20Condor
modified: 2026-10-30
index: https://www.quantconnect.com/llms.txt
---

# Short Iron Condor

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Trading and Orders > [Option Strategies](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/option-strategies.md) > Short Iron Condor

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## 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:

| Position | Strike |
| --- | --- |
| -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 C-D = A-B$ |

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](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/equity-options.md).
   ```python
   def initialize(self) -> None:
       self.set_start_date(2024, 9, 1)
       self.set_end_date(2024, 12, 31)
       self.set_cash(500000)

       self.universe_settings.asynchronous = True
       option = self.add_option("GOOG")
       self._symbol = option.symbol
       option.set_filter(lambda universe: universe.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.
2. In the `on_data` method, select the contracts in the strategy legs.
   ```python
   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]
   ```
3. In the `on_data` method, place the orders.
   **Approach A:** Call the `OptionStrategies.short_iron_condor` method with the details of each leg and then pass the result to the `buy` method.
   ```python
   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](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-market-orders.md), [combo_limit_order](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-limit-orders.md), or [combo_leg_limit_order](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-leg-limit-orders.md) method.
   ```python
   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

$$ \begin{array}{rcll} C^{far}_T & = & (S_T - K^C_{far})^{+}\\ C^{near}_T & = & (S_T - K^C_{near})^{+}\\ P^{far}_T & = & (K^P_{far} - S_T)^{+}\\ P^{near}_T & = & (K^P_{near} - S_T)^{+}\\ P_T & = & (C^{near}_T + P^{near}_T - C^{far}_T - P^{far}_T - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{far}_T & = & \textrm{Far OTM call value at time T}\\ & C^{near}_T & = & \textrm{Near OTM call value at time T}\\ & P^{far}_T & = & \textrm{Far OTM put value at time T}\\ & P^{near}_T & = & \textrm{Near ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^C_{far} & = & \textrm{Far OTM call strike price}\\ & K^C_{near} & = & \textrm{Near OTM call strike price}\\ & K^P_{far} & = & \textrm{Far OTM put strike price}\\ & K^P_{near} & = & \textrm{Near OTM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{far}_0 & = & \textrm{Far OTM call value at position opening (credit received)}\\ & C^{near}_0 & = & \textrm{Near OTM call value at position opening (debit paid)}\\ & P^{far}_0 & = & \textrm{Far OTM put value at position opening (credit received)}\\ & P^{near}_0 & = & \textrm{Near OTM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

In this example, the underlying stock price at expiration is $843.25. You traded a far-OTM call at $857.50 for $1.05, a near-OTM call at $852.50 for $2.75, a far-OTM put at $815.00 for $2.15, and a near-OTM put at $820.00 for $4.80.

The following chart shows the payoff at expiration:

![Short Iron Condor strategy payoff at expiration](https://cdn.quantconnect.com/docs/i/writing-algorithms/trading-and-orders/option-strategies/short-iron-condor.png)

The maximum profit is $K^C_{far} - K^C_{near} - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0$, where $K^P_{OTM} > S_T$ or $S_T > K^C_{OTM}$.

The maximum loss is the net debit paid: $C^{far}_0 + P^{far}_0 - C^{near}_0 - P^{near}_0$, where $K^P_{OTM} < S_T < K^C_{OTM}$.

If the Option is American Option, there is a risk of [early assignment](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/options-models/assignment.md) on the contracts you sell.

## Example

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

| Asset | Price ($) | Strike ($) |
| --- | --- | --- |
| Far-OTM call | 1.05 | 857.50 |
| Far-OTM put | 2.15 | 815.00 |
| Near-OTM call | 2.75 | 852.50 |
| Near-OTM put | 4.80 | 820.00 |
| Underlying Equity at expiration | 843.25 | - |

Therefore, the payoff is

$$ \begin{array}{rcll} C^{far}_T & = & (S_T - K^C_{far})^{+}\\ & = & (843.25-857.50)^{+}\\ & = & 0\\ C^{near}_T & = & (S_T - K^C_{near})^{+}\\ & = & (843.25-852.50)^{+}\\ & = & 0\\ P^{far}_T & = & (K^P_{far} - S_T)^{+}\\ & = & (815.00-843.25)^{+}\\ & = & 0\\ P^{near}_T & = & (K^P_{near} - S_T)^{+}\\ & = & (820.00-843.25)^{+}\\ & = & 0\\ P_T & = & (C^{near}_T + P^{near}_T - C^{far}_T - P^{far}_T - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0)\times m - fee\\ & = & (0+0-0-0-2.75-4.80+1.05+2.15)\times100-1\times4\\ & = & -439 \end{array} $$

So, the strategy loses $439.

The following algorithm implements a short iron condor Option strategy:

```python
class ShortIronCondorOptionStrategy(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        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.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)
```
