A Python-based stock analysis project that examines historical GOOG closing prices using rolling statistics, moving averages, Bollinger Bands, volatility measures, and drawdown analysis.
This project began as a rolling-window statistics assignment and was later expanded into a broader stock trend, volatility, and risk analysis tool.
The project:
- Calculates 20-day, 50-day, and 100-day moving averages
- Computes rolling minimum, maximum, mean, and standard deviation
- Builds Bollinger Bands using a 50-day window
- Calculates daily percentage returns
- Estimates annualized return volatility
- Measures maximum drawdown
- Summarizes the latest market position relative to rolling averages and Bollinger Bands
- Python
- pandas
- matplotlib
- Time-Series Analysis
- Financial Analytics
rolling-window-analysis/
├── rolling_window_analysis.py
├── rolling_window_output.png
├── updated_rolling_window_output.png
├── requirements.txt
└── README.md
The original GOOG dataset used for the academic assignment is not included in the public repository.
The program expects the dataset locally at:
data/GOOG.csv
with at least:
Date
Close
The enhanced version compares:
20-Day Moving Average
50-Day Moving Average
100-Day Moving Average
The project uses a 50-day rolling window:
Upper Band = 50-Day Mean + 2 × Standard Deviation
Lower Band = 50-Day Mean - 2 × Standard Deviation
The enhanced version also calculates:
Annualized Return Volatility
Maximum Drawdown
For the available GOOG dataset:
Annualized Return Volatility: 36.39%
Maximum Drawdown: -30.79%
Maximum Drawdown Date: 2020-03-23
Latest Close: $1,447.37
50-Day Average: $1,538.89
50-Day Price Std. Dev.: $61.91
Distance from Mean: -5.95%
Trend Position: Below Rolling Mean
Bollinger Position: Within Bollinger Bands
Install dependencies:
pip install -r requirements.txtRun the analysis:
python3 rolling_window_analysis.pyAastha Chavan
MS Business Analytics, Brandeis University

