Trading Options: Iron Condor Trading Strategy In Python

7 min read

Trading Options Iron Condor Trading Strategy In Python

By Nitin Thapar

Introduction

I have been trying to cover some of the simplest Option strategies including the Options Strangle Strategy and the Bull Call Spread Strategy which can be easily practised by traders who are new to Options. If you are new to options trading then you can check the options trading for dummies free course on Quantra. This time I will cover the Iron Condor trading strategy.

Anyone who trades in Option is well aware that they are constantly fighting against time decay, especially when you are on the buy side. A lot of strategies that are being practised are designed with an objective to have the time factor work for them rather than the other way around. One such strategy that can make the time decay work in your favour is the ‘Iron Condor’.

What Is Iron Condor Trading Strategy?

Iron Condor strategy is one of the simplest strategies that can be practised by traders even with a small account. For people who are familiar with other basic Option trading strategies, Iron Condor strategy is basically a combination of the bull put spread and bear call spread Option trading strategy.

Another simpler explanation for those who are not aware of the above-mentioned strategies is that Iron Condor strategy is a four-legged trade that starts with selling out-of-the-money put and selling out-of-the-money call for the same underlying security and expiration date. The trader will hope that the stock price stays between these positions at the time of its expiration. But shorting options can involve a lot of risks and any unfavourable situation can result in a tremendous loss. Hence, to protect this risk the trader buys further out-of-the-money put and call, these four options are together called as Iron Condor strategy.

It is important to understand that Iron Condor strategy is a limited risk strategy and works best in a stable market with low volatility which can help the trader to earn limited profits.

Strategy Characteristics

Moneyness of the options:

Sell 1 OTM Put (Higher Strike) Sell 1 OTM Call (Lower Strike) Buy 1 OTM Put (Lower Strike) Buy 1 OTM Call (Higher Strike)

Maximum Profit: Net Premium Received

Maximum Loss:

Strike Price of Long Call - Strike Price of Short Call - Net Premium Received or Strike Price of Short Put - Strike Price of Long Put - Net Premium Received whichever is higher

Breakeven:

Upper side: Strike Price of Short Call + Net Premium Received Lower side: Strike Price of Short Put - Net Premium Received

How does this strategy work?

Let us assume that a stock ABC is trading at a price of INR 100, to execute an Iron Condor trading strategy we will: Sell 80 Strike Put for INR 2.5 Sell 120 Strike Call for INR 2.5

With a hope that the price will remain within these two strike prices that we booked so that we make a profit. But, due to the risk of unlimited loss, we would protect our positions by: Buy 60 Strike Put for INR 1 Buy 140 Strike Call for INR 1

Call Strike and Put

Collectively these four positions will form the Iron Condor for us:

Formation of Iron Condor

How to implement this strategy?

Let us see how we can execute this strategy in a live market scenario.

For this, I will take the Option for Yes Bank Limited (Ticker – YESBANK) with an expiration date of 28th March 2018 and the current stock price of INR 323.40

Last 1-month stock price movement (source – Google Finance)

1-month stock price movement

Here is the option chain of YESBANK for the expiry date of 28th March 2018.

Option Chain

I will be taking the following positions: Sell 350 Call at INR 3.30 Sell 300 Put at INR 3.40 Buy 370 Call at INR 1.30 Buy 280 Put at INR 1.20

Call Options

Put Options

Source: nseindia.com

Maximum Profit:

In case the stock doesn’t bounce much and stays between my booked positions i.e. between the price of INR 300 and INR 350. My payoff will be as follows:

Max Profit

So we made money on the initial positions that we booked by Selling the options but we lost them on the positions that we booked for protection. The total payoff turns out to be positive on 4.2 points.

Maximum Loss:

Let’s assume that there is a major volatility or the market bumps due to an uncertain event and made the stock to go up to INR 390. So this means that the positions booked as long and short put is out of the money for us. Here is how the payoff will look like in this scenario:

Max Loss

We made INR 3.4 on the short put and lost INR 1.2 on the long put. The short call is 40 points in the money so we made a loss of INR 36.7 (3.30 – 40) and the long call is 20 points in the money which made us INR 18.7 (20 – 1.30). The total tally brings us to a loss of INR 15.8. Remember, the long call that we bought for protection helped us to minimize our loss on the total trade.

Another important thing to note is that this is the maximum we can lose on this trade no matter how far or low the stock goes.

Now let’s see how will be the payoff for a series of underlying price:

Payoff chart

We will now use the Python code to show you the payoff summary:

Import Libraries

import numpy as np
import matplotlib.pyplot as plt
import seaborn

Call Payoff

def call_payoff(sT, strike_price, premium):
return np.where(sT > strike_price, sT - strike_price, 0) – premium
# Stock price spot_price = 323.40
# Long call strike_price_long_call = 370 premium_long_call = 1.30
# Short call strike_price_short_call = 350 premium_short_call = 3.30
# Stock price range at expiration of the call sT = np.arange(0.5*spot_price,2*spot_price,1) payoff_long_call = call_payoff(sT, strike_price_long_call, premium_long_call) fig, ax = plt.subplots() ax.spines['bottom'].set_position('zero') ax.plot(sT,payoff_long_call,label='Long 370 Strike Call',color='g') plt.xlabel('Stock Price') plt.ylabel('Profit and loss') plt.legend() #ax.spines['top'].set_visible(False) # Top border removed #ax.spines['right'].set_visible(False) # Right border removed
#ax.tick_params(top=False, right=False) # Removes the tick-marks on the RHS plt.grid() plt.show()

Strike Call

payoff_short_call = call_payoff(sT, strike_price_short_call, premium_short_call) * -1.0

fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,payoff_short_call,label='Short 350 Strike Call',color='r')
plt.xlabel('Stock Price')
plt.ylabel('Profit and loss')
plt.legend()
plt.grid()
plt.show()

Strike Call

Put Payoff

def put_payoff(sT, strike_price, premium):
return np.where(sT < strike_price, strike_price - sT, 0) – premium
# Stock price spot_price = 323.40
# Long put strike_price_long_put = 280 premium_long_put = 1.20
# Short put strike_price_short_put = 300 premium_short_put = 3.40
# Stock price range at expiration of the put sT = np.arange(0.5*spot_price,2*spot_price,1) payoff_long_put = put_payoff(sT, strike_price_long_put, premium_long_put) fig, ax = plt.subplots() ax.spines['bottom'].set_position('zero') ax.plot(sT,payoff_long_put,label='Long 280 Strike Put',color='y') plt.xlabel('Stock Price') plt.ylabel('Profit and loss') plt.legend() plt.grid() plt.show()

Short Put

payoff_short_put = put_payoff(sT, strike_price_short_put, premium_short_put) * -1.0

fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,payoff_short_put,label='Short 300 Strike Put',color='m')
plt.xlabel('Stock Price')
plt.ylabel('Profit and loss')
plt.legend()
plt.grid()
plt.show()

Strike Put

Iron Condor Strategy Payoff

payoff = payoff_long_call + payoff_short_call + payoff_long_put + payoff_short_put

fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,payoff_long_call,'--',label='Long 370 Strike Call',color='g')
ax.plot(sT,payoff_short_call,'--',label='Short 350 Strike Call',color='r')
ax.plot(sT,payoff_long_put,'--',label='Long 280 Strike Put',color='y')
ax.plot(sT,payoff_short_put,'--',label='Short 300 Strike Put',color='m')
ax.plot(sT,payoff,label='Iron Condor')
plt.xlabel('Stock Price')
plt.ylabel('Profit and loss')
plt.legend()
plt.grid()
plt.show()

Iron Condor

Next Step

Learn the modelling of option pricing using Black Scholes Option Pricing model and plotting the same for a combination of various options. You can put any number of call and/or put options in this model and use a built-in macro (named ‘BS’) for calculating the BS model based option pricing for each option.

Update: We have noticed that some users are facing challenges while downloading the market data from Yahoo and Google Finance platforms. In case you are looking for an alternative source for market data, you can use Quandl for the same. 

Disclaimer: All investments and trading in the stock market involve risk. Any decisions to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.

Download Python Code

  • Iron Condor Trading Strategy Python Code File

    
Algo Trading Conference 2025