This project fetches and analyzes options data for the SPDR S&P 500 ETF (SPY) to visualize implied volatility surfaces and option prices.
The goal of this project is to provide a visual representation of the implied volatility "smile" or "skew" for SPY options. It generates interactive 3D surface plots for implied volatility across different strike prices and expirations, as well as scatter plots showing the relationship between option prices, strikes, and time to maturity.
The analysis is done separately for call and put options. The resulting interactive plots are saved as HTML files in the src/ directory.
This project generates the following interactive plots:
- Implied Volatility Surface (3D): A 3D surface plot showing implied volatility as a function of strike price and days to expiration. This helps in visualizing the volatility smile and term structure.
- Option Price Scatter (3D): A 3D scatter plot showing the last price of options as a function of strike price and days to expiration.
-
Clone the repository:
git clone https://github.com/your-username/SPY-implied-vol.git cd SPY-implied-vol -
Install dependencies: You will need to have R installed. Run the following command in the R console to install the necessary packages.
# Likely packages used, please verify from your R script install.packages(c("plotly", "quantmod", "tidyverse", "janitor", "akima"))
-
Run the analysis: Run the R markdown notebook
implied_volatility.Rto create the 4 visualizations. -
View the output: The generated interactive HTML plots can be found in the
src/directory. Open them in any web browser.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.