<jupyter_start><jupyter_text>Setup* Buy a call, strike price A* Sell two calls, strike price B* Skip over strike price C* Buy a call, strike price D<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')<jupyter_output><empty_output><jupyter_text>Call payoff<jupyter_code>def call_payoff (sT, strike_price, premium):
    return np.where(sT> strike_price, sT-strike_price, 0)-premium
# Assumed Spot Price
s0 = 1164

# Long Call (A)
lower_strike_price_long_call= 1140
premium_lower_strike_long_call = 36.5

# Short Call (B)
strike_price_short_call = 1160
premium_short_call = 23.5

# Long Call (D)
higher_strike_price_long_call = 1200
premium_higher_strike_long_call = 8.5


# Range of call option at epiration
sT = np.arange(1050,1250,1)<jupyter_output><empty_output><jupyter_text>Long Call Payoff<jupyter_code># lower Strike Long Call Payoff

lower_strike_long_call_payoff = call_payoff(sT, lower_strike_price_long_call, premium_lower_strike_long_call)

fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,lower_strike_long_call_payoff, color='g')
ax.set_title('LONG 1140 Strike Call')
plt.xlabel('Stock Price')
plt.ylabel('Profit & Loss')
plt.grid()

plt.show()
# Higher Strike Long Call Payoff

higher_strike_long_call_payoff = call_payoff(sT, higher_strike_price_long_call, premium_higher_strike_long_call)

fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,higher_strike_long_call_payoff, color='g')
ax.set_title('LONG 1200 Strike Call')
plt.xlabel('Stock Price (sT)')
plt.ylabel('Profit & Loss')
plt.grid()

plt.show()<jupyter_output><empty_output><jupyter_text>Short Call Payoff<jupyter_code># Short Call Payoff 

Short_call_payoff = 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, Short_call_payoff, color='r')
ax.set_title('Short 1160 Strike Call')
plt.xlabel('Stock Price')
plt.ylabel('Profit & Loss')
plt.grid()

plt.show()<jupyter_output><empty_output><jupyter_text>Broken Wing Butterfly Spread Payoff<jupyter_code>BrokenWing_Butterfly_spread_payoff = lower_strike_long_call_payoff + higher_strike_long_call_payoff + 2 *Short_call_payoff


fig, ax = plt.subplots()
ax.spines['bottom'].set_position('zero')
ax.plot(sT,BrokenWing_Butterfly_spread_payoff ,color='b', label= 'Broken Wing Butterfly Spread')
ax.plot(sT, lower_strike_long_call_payoff,'--', color='g',label='Lower Strike Long Call')
ax.plot(sT, higher_strike_long_call_payoff,'--', color='g', label='Higher Strike Long Call')
ax.plot(sT, Short_call_payoff, '--', color='r', label='Short call')

plt.legend()
plt.grid()
plt.xlabel('Stock Price')
plt.ylabel('Profit & Loss')
plt.show()
profit = max(BrokenWing_Butterfly_spread_payoff)
loss = min(BrokenWing_Butterfly_spread_payoff)

print ("Max Profit %.2f" %profit)
print ("Max Loss %.2f" %loss)<jupyter_output>Max Profit 22.00
Max Loss -18.00
{'fraction_non_alphanumeric': 0.12801358234295415, 'fraction_numerical': 0.02037351443123939, 'mean_word_length': 7.846846846846847, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '293644', 'license': 'MIT', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1136, 'n_words': 218, 'path': 'Strategies (Visualization)/Broken Wing Butterfly.ipynb', 'repo_name': 'atheesh1998/OpStrat', 'size': '2945'}