This Python script provides a comprehensive analysis of stock options using data retrieved from Yahoo Finance. It calculates various metrics such as implied volatility, historical volatility, intrinsic value, and time value for stock options. The analysis is based on the Black-Scholes option pricing model and historical stock price data.
• Option Data Retrieval: Fetches option data including expiration dates, strike prices, and last prices from Yahoo Finance.
• Implied Volatility Calculation: Uses the Black-Scholes model to calculate the implied volatility of options.
• Intrinsic Value Calculation: Computes the intrinsic value of call and put options based on the current stock price.
• Time Value Calculation: Determines the time value of options by subtracting the intrinsic value from the option price.
• Historical Volatility Calculation: Estimates the historical volatility of the underlying stock using historical price data.
• Data Export: Saves the analyzed option data along with calculated metrics to an Excel file for further analysis.
-
Run the script and enter the symbol of the stock you want to analyze.
-
The script will retrieve option data for the specified stock and perform the analysis.
-
Analyzed data is saved to an Excel file, which can be downloaded for further examination.
• yfinance: For retrieving stock and option data from Yahoo Finance.
• numpy: For numerical computations.
• scipy: For statistical functions.
• pandas: For data manipulation and analysis.
• openpyxl: For creating Excel files.
• google.colab: For downloading files in Google Colab environment.
This project is licensed under the MIT License - see the LICENSE file for details.
• This script is inspired by the Black-Scholes option pricing model and various resources on options trading.
Special thanks to the developers of yfinance and other libraries used in this project.