Hi Team ,
Thank you for this wonderful course . But wanted to know if options_daily_sp500_2018_2022.csv contains only ATM contracts or not . What kind of options contracts were selected and why expiry date was skipped.
Need more clarity on Option data formation .
Thank you !!!
With Warm Regards
Nandagopal
Hello Nandagopal, glad to know that you liked the course.
Yes, the "options_daily_sp500_2018_2022.csv" contains data on ATM contracts. This decision was made because we intend to deploy the "straddle" strategy, which relies on implied volatility, and ATM contracts are used to create a straddle. For more details on the straddle strategy, you can refer to this link.
The dataset does not explicitly state the expiry date because it pertains to monthly expiry SPX options, where the expiry date corresponds to the last trading day of the month. Therefore, there was no necessity to explicitly mention the expiry date in the dataset.
Data sourcing:
You can visit section 2 of the course for data sourcing and storing using Python. As per the notebook in Section 2, unit 3 the following piece of code stores SPX options contracts of multiple expiries
# Read the files and store the necessary data in a dataframe
for file_name in all_files:
monthly_data = pd.read_csv(file_name, sep=',')
# Move the files to the master dataframe
options_data = options_data.append(monthly_data)
# Delete the extracted files
os.remove(file_name)
But, to filter just the monthly expiry contract, you need to do a minor modification to this code as below:
# Read the files and store the necessary data in a dataframe
for file_name in all_files:
monthly_data = pd.read_csv(file_name, sep=',')
# Select only end-of-month expiry (EOM) contracts
monthly_data = monthly_data[(monthly_data[' [EXPIRE_DATE]'] ==
monthly_data[' [QUOTE_DATE]'].iloc[-1])]
monthly_data = monthly_data[read_col]
# Move the files to the master dataframe
options_data = options_data.append(monthly_data)
# Delete the extracted files
os.remove(file_name)
I hope this helps! Please let us know if you have any more queries on this.
Hi Varun ,
Thank you very much !!!
One more doubt . In the capstone Project , we have got the delow condition to set straddle. Can we use the same condition to set the strangle or if the condition is different , please help to provide the same .
# Check conditions to open long straddle
if (forecasted_volatility100 > options_data.iloc[index_].C_IV) and (forecasted_volatility100 > options_data.iloc[index_].P_IV):
# Assign 1 as signal value for 5 trading days
options_data.iloc[index_:index_+4].signal = 1
# Reset the counter as a new position is opened
days_since_last_signal = 0
# Check conditions to open short straddle
elif (forecasted_volatility100 < options_data.iloc[index_].C_IV) and (forecasted_volatility100 < options_data.iloc[index_].P_IV):
# Assign -1 as signal value for 5 trading days
options_data.iloc[index_:index_+4].signal = -1
# Reset the counter as a new position is opened
days_since_last_signal = 0
Thank you !!!
With Warm Regards
Nandagopal
Hello Nandagopal,
The conditions for a straddle and a strangle are similar. The main difference lies in the type of options used. For a straddle, you compare the forecasted volatility with the implied volatility of at-the-money (ATM) options. For a strangle, you compare the forecasted volatility with the implied volatility of out-of-the-money (OTM) options. This means for a strangle, you use the implied volatility of the OTM call and put options that you select for the strategy.
I hope this helps!
Hello Nandagopal, glad to know that you liked the course. This query was replied here.