This Python script extracts historical stock data for a given stock symbol from Yahoo Finance and performs data processing and visualization tasks.
Make sure you have the following libraries installed:
- pandas
- yfinance
- matplotlib
- mplfinance
You can install these libraries using pip:
- Open the
stock_data_extraction.py
file. - Modify the
symbol
,start_date
, andend_date
variables according to your requirements. - Run the script.
The script will extract historical stock data for the specified symbol and date range, calculate additional parameters such as return, volatility, market cap, and P/E ratio, and save the data to a CSV file.
It will also print the average daily trading volume and visualize the stock's volatility over time.