# Option Strategies

### Introduction

Bull put spread, which is also known as long put spread, consists of buying an OTM put and selling an ITM put. Both puts have the same underlying stock and the same expiration date. The OTM put serve as a hedge of the ITM put. It is a option strategy profitting from a rise in underlying asset price.

This is a limited-reward-limited-risk strategy. The payoff is as follows:

$Payoff_{OTM\ put}=(Strike_{OTM\ put}-Price_{underlying})^{+}$

$Payoff_{ITM\ put}=(Strike_{ITM\ put}-Price_{underlying})^{+}$

$Profit/Loss=(Payoff_{OTM\ put}-Payoff_{ITM\ put}+credit\ received_{ITM\ put}-debit\ paid_{OTM\ put})\times multiplier-commissions$ The maximum profit is the net credit received after commission when opening the trade. If the price rised and higher than the strike prices of both puts, both puts become worthless.

Maximum loss is the spread between the 2 options' strike prices minus net credit received when opening the trade, where the underlying price is below both strike prices and the options being exercised/assigned at expiration.

If the option is American option, there will be a risk of early assignment on the shorted option.

### Implementation

1. In the Initialize method, set the start date, end date, cash, and Option universe.
2. private Symbol _symbol;

public override void Initialize()
{
SetStartDate(2017, 2, 1);
SetEndDate(2017, 3, 5);
SetCash(500000);

_symbol = option.Symbol;
option.SetFilter(universe => universe.IncludeWeeklys()
.Strikes(-15, 15)
.Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
}
def Initialize(self) -> None:
self.SetStartDate(2017, 2, 1)
self.SetEndDate(2017, 3, 5)
self.SetCash(500000)

self.symbol = option.Symbol
option.SetFilter(self.UniverseFunc)

def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
3. In the OnData method, select the Option contracts.
4. public override void OnData(Slice slice)
{
if (Portfolio.Invested) return;

// Get the OptionChain of the symbol
var chain = slice.OptionChains.get(_symbol, null);
if (chain.Count() == 0) return;

// sorted the optionchain by expiration date and choose the furthest date
var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;

// filter the put options from the contracts which expire on the furthest expiration date in the option chain.
var puts = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Put);
if (puts.Count() == 0) return;

// sort the put options with the same expiration date according to their strike price.
var putStrikes = puts.Select(x => x.Strike).OrderBy(x => x);

// select the strike prices for forming the option legs
// the ITM put option with the highest strike price (short) and the OTM put with the lowest strike price (long).
var itmStrike = putStrikes.Last();
var otmStrike = putStrikes.First();
def OnData(self, slice: Slice) -> None:
# avoid extra orders
if self.Portfolio.Invested: return

# Get the OptionChain of the self.symbol
chain = slice.OptionChains.get(self.symbol, None)
if not chain: return

# sorted the optionchain by expiration date and choose the furthest date
expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True).Expiry

# filter the put options from the contracts which expire on the furthest expiration date in the option chain.
puts = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Put]
if len(puts) == 0: return

# sort the put options with the same expiration date according to their strike price.
put_strikes = sorted([x.Strike for x in puts])

# select the strike prices for forming the option legs
# the OTM put option with the lowest strike price (long) and the ITM put with the highest strike price (short).
otm_strike = put_strikes
itm_strike = put_strikes[-1]
5. In the OnData method, call the OptionStrategies.BullPutSpread method and then submit the order.
6. var optionStrategy = OptionStrategies.BullPutSpread(_symbol, itmStrike, otmStrike, expiry);
// We open a position with 1 unit of the option strategy
}
option_strategy = OptionStrategies.BullPutSpread(self.symbol, itm_strike, otm_strike, expiry)
# We open a position with 1 unit of the option strategy
self.Buy(option_strategy, 1)

### Summary

In this algorithm, we've realised the below payout at expiration (2022-3-4).

ItemsPrice
Price of OTM put$5.70 Price of ITM put$ 35.50
Strike of OTM put$767.50 Strike of ITM put$ 835.00
Price of underlying at expiration$829.08 Commission per trade$ 1.00
$Payoff_{OTM\ put}=(767.50-829.08)^{+}=0$

$Payoff_{ITM\ put}=(835.00-829.08)^{+}=5.92$

$Profit/Loss=(0-5.92+35.50-5.70)\times100-1.00\times2=2386$

So, the strategy profits \$2386.

### Algorithm

You can also see our Videos. You can also get in touch with us via Discord.