# Modeling Of A Box Spread Using Python

• Creating a bull spread involves the following:
• Buying a call option with a strike price of K1
• Selling a call option with a strike price of K2
• Buying a put option with a strike price of K2
• Selling a put option with a strike price of K1
• Box spread is a delta neutral strategy.
• The payoff the box spread is always K2-K1.

 # Python example code that models option strategy - Box Spread K1 = 100 K2 = 150   #K3 = 100 #K4 = 150   stockPrice = 130   i = 0   while i < 5:     stockPrice  = stockPrice + 10     payoff      = 0     if (stockPrice <= K1):         payoff      = K2-K1;     elif (stockPrice > K1 and stockPrice < K2):         payoff      = K2 - K1;     elif (stockPrice >= K2):         payoff  = K2-K1;     else:         print("Invalid");            print("Stock price:%2.2f"%stockPrice);     print("Payoff from the box spread:%2.2f"%payoff);     print("-")     i = i + 1;      stockPrice = 130 i = 0;    while i <= 5:     stockPrice  = stockPrice - 10     payoff      = 0     if (stockPrice <= K1):         payoff      = K2-K1;     elif (stockPrice > K1 and stockPrice < K2):         payoff      = K2 - K1;     elif (stockPrice >= K2):         payoff  = K2-K1;     else:         print("Invalid");            print("Stock price:%2.2f"%stockPrice);     print("Payoff from the box spread:%2.2f"%payoff);     print("-")     i = i + 1;