avatarDiego Degese

Summary

The article presents a backtesting analysis of a financial investment strategy involving selling naked puts on QQQ, utilizing data from 2012 to 2023, with a focus on options having a delta of -0.18 and a 7-day expiration.

Abstract

The author of the article shares their experience with a specific options trading strategy, namely selling naked puts on the QQQ ETF. This strategy is examined through a comprehensive backtesting analysis using historical data dating back to 2012. The strategy specifically targets the sale of put options with a delta of approximately -0.18, which are slightly out-of-the-money, and have a short time frame until expiration of just 7 days. The article includes a detailed breakdown of the Python code used to analyze the data, including the selection of options, calculation of fees, and the final results of the strategy. The findings reveal that out of 854 options traded, 91 closed in-the-money, resulting in a profit of $188,020. The author emphasizes the educational nature of the article and encourages readers to engage with their work by following, clapping, and accessing the full source code and colab notebook provided.

Opinions

  • The author believes that selling QQQ naked puts offers an intr

I Tested the Naked Puts Strategy with QQQ and Earned… 😱

Imagine yourself as someone who is exploring the world of investment strategies and looking for a way that offers a good mix of risk and reward. Imagine a strategy where you sell QQQ naked puts and do nothing with them until they expire. Doesn’t it sound intriguing? 🤔🤔🤔

This article will guide you through such a strategy, supported by a thorough backtesting analysis that uses data going back to 2012. We’ll examine the nuances of selling options with a delta of roughly -0.18 that expires in just 7 days to see what insights and results this strategy might reveal. So buckle up as we explore the effectiveness and implications of this intriguing investment strategy by traveling through time and numbers.

Before I share all the following information, if you enjoy reading my articles, please hit the follow button — Diego Degese

About the options data, I am using the information downloaded from optionsdx.com.

I don’t have any association with them but I would like to give you the information to allow you to download the data yourself if you want to. I already published an article on how to do it.

Let’s start with the basics…

What is a Naked Put?

A naked put is an options trading strategy that involves selling put options without holding a corresponding position in the underlying asset. In other words, it’s a bullish strategy where an investor sells a put option contract with the expectation that the price of the underlying asset will either remain stable or increase over time.

Here’s how the process works:

  1. Put Options: A put option gives the buyer the right, but not the obligation, to sell a specific asset (like a stock or an exchange-traded fund) at a predetermined price (strike price) before or on the option’s expiration date. The seller of the put option is obligated to buy the asset at the strike price if the buyer decides to exercise the option.
  2. Selling Naked Puts: In the context of selling naked puts, an investor (the option seller) sells put options to other market participants. By doing so, the investor collects a premium (a payment) from the buyer of the option. The seller’s goal is for the price of the underlying asset to either remain steady or rise, allowing the put option to expire without being exercised.
  3. Profit and Risk: The seller’s profit is the premium collected at the outset. If the price of the underlying asset remains above the strike price by the expiration date, the put option will likely expire worthless, and the seller retains the premium as profit. However, if the price of the underlying asset falls significantly below the strike price, the seller may incur losses, as they are obliged to buy the asset at a higher strike price than the current market value.
  4. Delta and Strategy: The delta is a measure that indicates how much the option price is expected to change in relation to a change in the underlying asset’s price. Selling options with a delta of around -0.18 suggests a relatively low probability of the option being exercised, as it’s slightly out-of-the-money (the strike price is above the current asset price). This aligns with the strategy’s underlying assumption of the asset’s price remaining stable or increasing.
  5. Expiration and Strategy Duration: By selling options expiring in just 7 days, this strategy seeks to capitalize on short-term price movements. If the price remains stable or rises during this short window, the seller benefits. However, the short time frame also means the potential for rapid changes, requiring careful monitoring.

Everything is Fine, but Where is the Code?

Image from justwatch.com

We are a little bit anxious 😬😬😬 but here it is… Let’s break down the code step by step along with explanations for each snippet.

import numpy as np
import pandas as pd

Import the necessary libraries, NumPy for numerical computations, and pandas for data manipulation and analysis.

# Constants
FILENAME = '../data/qqq_puts.csv.gz'
FEES_PER_CONTRACT = 0.6
CONTRACTS_QTY = 10

Define some constants:

  • FILENAME: The file path to a CSV file containing data related to the QQQ put options.
  • FEES_PER_CONTRACT: The fees associated with each contract (both buying and selling).
  • CONTRACTS_QTY: The number of contracts involved in the strategy.
# Read file
df = pd.read_csv(FILENAME, header=0)

Read the CSV file into a pandas DataFrame named df.

# Convert date fields to datetime
df['date'] = pd.to_datetime(df['date'])
df['expire_date'] = pd.to_datetime(df['expire_date'])

Convert the ‘date’ and ‘expire_date’ columns in the DataFrame to datetime format for easier usage.

# Get all the options expiring in 7 days
df_open = df[df['dte'] == 7]

Create a new DataFrame named df_open by filtering rows where the 'dte' (days to expiration) column is equal to 7 days.

# Get all the expired options
# If the underlying last > strike, set the ask price to 0.00
df_close = df[(df['dte'] == 0)]
df_close.loc[df_close['underlying_last'] >= df_close['strike'], 'ask'] = 0

Create a DataFrame named df_close by filtering rows where the 'dte' column is 0 days (expired options). If the 'underlying_last' (last trading price of the underlying asset) is greater than or equal to the 'strike' price, set the 'ask' price to 0. This is likely done to simulate the fact that options that are out-of-the-money at expiration are worthless and therefore have no ask price.

# Filter options with delta close to 0.18
df_open = df_open[(df_open['delta'] > -0.18) & (df_open['delta'] < -0.10)]
idx = df_open.groupby(['expire_date'])['delta'].transform(min) == df_open['delta']
df_open = df_open[idx]

Further filter the df_open DataFrame by selecting options with a 'delta' value between -0.18 and -0.10. The idx variable is used to filter out options with the minimum delta value for each expiration date.

# Generate the dataset with the combination
df_op = pd.merge(df_open, df_close, how='inner', on=['expire_date','strike'], suffixes=['_sell','_buy'])
df_op = df_op.reset_index(drop=True)

Merge the df_open and df_close DataFrames on 'expire_date' and 'strike', creating a new DataFrame named df_op with data about options that meet the specified criteria. The reset_index call resets the index of the DataFrame.

# Calculate fees
df_op['fees'] = np.where(df_op['underlying_last_buy'] >= df_op['strike'], FEES_PER_CONTRACT, 2 * FEES_PER_CONTRACT)

Calculate fees for each option in the df_op DataFrame based on whether the 'underlying_last_buy' price (price of the underlying asset at buy) is greater than or equal to the 'strike' price. The fees are calculated differently for in-the-money and out-of-the-money options.

# Generate result
puts_qty = len(df_op)
puts_itm = len(df_op[df_op['underlying_last_buy'] < df_op['strike']])
profit_loss = (((df_op['bid_sell'] - df_op['ask_buy']) * 100 - df_op['fees']) * CONTRACTS_QTY).sum()

print(f' NAKED PUTS STRATEGY - RESULT '.center(70, '*'))
print(f'Closing ITM: {100 * puts_itm / puts_qty:.2f}% ({puts_itm} / {puts_qty})')
print(f"     Result: $ {profit_loss:.2f}")

Calculate and display the results:

  • puts_qty: Total number of options that meet the criteria.
  • puts_itm: Number of in-the-money options among the selected options.
  • profit_loss: Calculate the overall profit or loss by considering the bid-sell spread, fees, and the number of contracts.

Finally, the script prints the results, including the percentage of in-the-money options and the calculated profit/loss.

Before we proceed with the results, I want to mention that I’ve personally created all the source code featured in my articles. I’ve done this to share my own experiences and help you avoid the need to spend your valuable time redeveloping the same strategies. If you enjoy reading my articles, please share them with your friends and please don’t forget to hit the follow button — Diego Degese

Results, Results, Results…

Ladies and gentlemen, gather ‘round and prepare to be amazed by the daring dance of data and finance!

Welcome to the grand reveal of our Naked Puts Strategy results — the moment you’ve all been waiting for! Drumroll, please… 🥁🥁🥁

Behold, the numbers that are about to dazzle you like a Wall Street wizardry show…

******************** NAKED PUTS STRATEGY - RESULT ********************
Closing ITM: 10.66% (91 / 854)
     Result: $ 188020.00

Closing ITM: 10.66% (91 out of 854)

Yes, you heard that right! We’re talking about the “In-The-Money” options that decided to strut their stuff and showcase their moves. They’re like the A-list celebrities of the options world, making their presence known with style and flair.

But wait, that’s not all! Brace yourselves for the pièce de résistance:

Result: $188,020.00

That’s not a typo; it’s the delightful symphony of profits and gains that our strategy has orchestrated. It’s like turning pocket change into a treasure chest fit for a modern-day pirate. Arrr, matey, who needs doubloons when you’ve got options?

So, there you have it, folks! Our Naked Puts Strategy isn’t just about financial acrobatics — it’s about making those numbers dance to the rhythm of prosperity. We’ve got options strutting their ITM stuff and a profit that’s worthy of a standing ovation.

Thank you for joining me on this thrilling journey through the world of options and numbers. Stay tuned for more financial feats and daring data escapades!

If you enjoy my work, please support me on Medium by becoming a member through my referral link, and consider giving it a clap as a small gesture of motivation. Thank you!

Download the full source code and the colab notebook of this article from here

Twitter / X: https://twitter.com/diegodegese LinkedIn: https://www.linkedin.com/in/ddegese Github: https://github.com/crapher

Disclaimer: Investing in the stock market involves risk and may not be suitable for all investors. The information provided in this article is for educational purposes only and should not be construed as investment advice or a recommendation to buy or sell any particular security. Always do your own research and consult with a licensed financial advisor before making any investment decisions. Past performance is not indicative of future results.

A Message from InsiderFinance

Thanks for being a part of our community! Before you go:

Options Strategy
Options Trading
Backtesting
Data Science
Python
Recommended from ReadMedium