Option Strategies
Bull Put Spread
Introduction
Bull put spread, also known as long put spread, consists of buying an OTM put and selling an ITM put. Both puts have the same underlying Equity and the same expiration date. The OTM put serves as a hedge for the ITM put. The bull put spread profits from a rise in underlying asset price.
Implementation
Follow these steps to implement the bull put spread strategy:
- In the
initialize
method, set the start date, end date, cash, and Option universe. - In the
on_data
method, select the expiration and strikes of the contracts in the strategy legs. - In the
on_data
method, select the contracts and place the orders.
def initialize(self) -> None: self.set_start_date(2017, 2, 1) self.set_end_date(2017, 3, 5) self.set_cash(500000) self.universe_settings.asynchronous = True option = self.add_option("GOOG", Resolution.MINUTE) self._symbol = option.symbol option.set_filter(lambda universe: universe.include_weeklys().put_spread(30, 5))
The put_spread
filter narrows the universe down to just the two contracts you need to form a bull put spread.
def on_data(self, slice: Slice) -> None: if self.portfolio.invested: return # Get the OptionChain chain = slice.option_chains.get(self._symbol, None) if not chain: return # Select the put Option contracts with the furthest expiry expiry = max([x.expiry for x in chain]) puts = [i for i in chain if i.expiry == expiry and i.right == OptionRight.PUT] if not puts == 0: return # Select the ITM and OTM contract strike prices from the remaining contracts strikes = [x.strike for x in puts] otm_strike = min(strikes) itm_strike = max(strikes)
Approach A: Call the OptionStrategies.bull_put_spread
method with the details of each leg and then pass the result to the buy
method.
option_strategy = OptionStrategies.bull_put_spread(self._symbol, itm_strike, otm_strike, expiry) self.buy(option_strategy, 1)
Approach B: Create a list of Leg
objects and then call the combo_market_order, combo_limit_order, or combo_leg_limit_order method.
itm_put = [x for x in puts if x.strike == itm_strike][0] otm_put = [x for x in puts if x.strike == otm_strike][0] legs = [ Leg.create(itm_put.symbol, -1), Leg.create(otm_put.symbol, 1) ] self.combo_market_order(legs, 1)
Strategy Payoff
This is a limited-reward-limited-risk strategy. The payoff is
POTMT=(KOTM−ST)+PITMT=(KITM−ST)+PT=(POTMT−PITMT+PITM0−POTM0)×m−fee wherePOTMT=OTM put value at time TPITMT=ITM put value at time TST=Underlying asset price at time TKOTM=OTM put strike priceKITM=ITM put strike pricePT=Payout total at time TPITM0=ITM put value at position opening (credit received)POTM0=OTM put value at position opening (debit paid)m=Contract multiplierT=Time of expirationThe following chart shows the payoff at expiration:

The maximum profit is the net credit you received when opening the position, PITM0−POTM0. If the underlying price is higher than the strike prices of both put contracts at expiration, both puts expire worthless.
The maximum loss is KOTM−KITM+PITM0−POTM0.
If the Option is American Option, there is a risk of early assignment on the contract you sell.
Example
The following table shows the price details of the assets in the algorithm:
Asset | Price ($) | Strike ($) |
---|---|---|
OTM put | 5.70 | 767.50 |
ITM put | 35.50 | 835.00 |
Underlying Equity at expiration | 829.08 | - |
Therefore, the payoff is
POTMT=(KOTM−ST)+=(767.50−829.08)+=0PITMT=(KITM−ST)+=(835.00−829.08)+=5.92PT=(POTMT−PITMT+PITM0−POTM0)×m−fee=(0−5.92+35.50−5.70)×100−1.00×2=2386So, the strategy profits $2,386.
The following algorithm implements a bull put spread strategy:
class BullPutSpreadStrategy(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2017, 2, 1) self.set_end_date(2017, 3, 5) self.set_cash(500000) option = self.add_option("GOOG", Resolution.MINUTE) self.symbol = option.symbol option.set_filter(self.universe_func) def universe_func(self, universe: OptionFilterUniverse) -> OptionFilterUniverse: return universe.include_weeklys().put_spread(30, 5) def on_data(self, slice: Slice) -> None: if self.portfolio.invested: return # Get the OptionChain chain = slice.option_chains.get(self.symbol, None) if not chain: return # Get the furthest expiration date of the contracts expiry = sorted(chain, key = lambda x: x.expiry, reverse=True)[0].expiry # Select the put Option contracts with the furthest expiry puts = [i for i in chain if i.expiry == expiry and i.right == OptionRight.PUT] if len(puts) == 0: return # Select the ITM and OTM contract strikes from the remaining contracts put_strikes = sorted([x.strike for x in puts]) otm_strike = put_strikes[0] itm_strike = put_strikes[-1] option_strategy = OptionStrategies.bull_put_spread(self.symbol, itm_strike, otm_strike, expiry) self.buy(option_strategy, 1)
Other Examples
For more examples, see the following algorithms: