# Modeling A Butterfly Spread Using Python

## Overview:

• When the investors assume that market volatility is going to be very little they employ butterfly spread strategy.
• In a butterfly spread, when the stock price wanders around K2, the midpoint - it gives profit.
• However, at the date of expiry if the stock price is less than K1 or greater than K3, the whole position will expire worthless.
• Construction of a butterfly spread involves,
1. Buying of a European call option at price K1
2. Buying of a European call option at price K3
3. Selling of two European call options at a price, which is a midpoint between K1 and K3.

## Example:

 # Python example code that models the option strategy - butterfly spread K1 = 100 K2 = 200 K3 = 300   stockPrice = 200   i = 0   while i < 10:     stockPrice  = stockPrice + 25     payoff      = 0     if (stockPrice > K1 and stockPrice <= K2):         payoff      = stockPrice - K1;     elif (stockPrice > K2 and stockPrice < K3):         payoff      = K3 - stockPrice;     elif (stockPrice <= K1):         payoff  = 0;     elif (stockPrice >= K3):         payoff  = 0;            else:         payoff  = 0;            print("Stock price:%2.2f"%stockPrice);     print("Payoff from butterfly spread:%2.2f"%payoff);     print("-")     i = i + 1;      stockPrice = 200     while i >= 0 :     stockPrice  = stockPrice - 25     payoff      = 0     if (stockPrice > K1 and stockPrice <= K2):         payoff      = stockPrice - K1;     elif (stockPrice > K2 and stockPrice < K3):         payoff      = K3 - stockPrice;     elif (stockPrice <= K1):         payoff  = 0;     elif (stockPrice >= K3):         payoff  = 0;            else:         payoff  = 0;            print("Stock price:%2.2f"%stockPrice);     print("Payoff from butterfly spread:%2.2f"%payoff);     print("-")     i = i - 1;