Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Stock Volatility and Earnings Reports

This project explores the relationship between corporate earnings reports and short-horizon stock price volatility. Using historical market data and earnings schedules, the goal is to evaluate whether volatility around earnings events can be anticipated using machine learning models.

The accompanying notebook contains exploratory analysis and multiple modeling approaches; this README summarizes the final, defensible results.


Project Overview

  • Universe: 50 S&P 500 equities
  • Time Range: 2020–2025
  • Target: Short-term realized / rolling volatility
  • Focus: Feature engineering, model comparison, and time-series prediction

Key questions addressed:

  1. Can future volatility be predicted using historical price, volume, and event-based features?
  2. Do earnings reports meaningfully contribute to volatility dynamics?

Data Sources

  • Yahoo Finance (yfinance):
    • Daily open, high, low, close, and volume
  • Alpha Vantage API:
    • Earnings report dates
    • Reported and estimated EPS
    • Earnings surprise metrics

Stock tickers were scraped from Wikipedia’s S&P 500 list and standardized for API compatibility.


Feature Engineering

Engineered features include:

  • Logarithmic returns
  • Rolling volatility (derived from log returns)
  • Relative Strength Index (RSI) and RSI classification
  • Days to earnings (countdown to next earnings report)
  • Lagged volatility features
  • Volume-based rolling statistics
  • Earnings-based features (e.g., last reported EPS)

These features were synchronized on a daily time scale for each stock.


Models Evaluated

The following models were implemented and compared:

  • Linear Regression
    • Used as a baseline to understand volatility persistence
  • XGBoost
    • Used primarily for feature importance and non-linear relationships
  • LSTM (Long Short-Term Memory Neural Network)
    • Used for sequential time-series prediction and final evaluation

Validation strategies included held-out evaluation for classical models and sequential (time-aware) holdout for the LSTM.


Results Summary

Model Purpose Performance
Linear Regression Baseline / exploratory Used for comparison
XGBoost Feature importance & baseline prediction Lower predictive performance
LSTM Primary predictive model R² ≈ 0.79 on unseen time-series data

The LSTM demonstrated the strongest generalization performance when evaluated on future, unseen time periods, highlighting the importance of sequence-aware modeling for volatility prediction.


Repository Contents

  • Stock-Volatility.ipynb contains the full data pipeline, feature engineering, exploratory analysis, and model implementations.
  • Some sections reflect exploratory work conducted during development.

My Contributions (Charles Heese)

  • Built the end-to-end data pipeline and feature engineering framework for price, volatility, and earnings-based signals.
  • Implemented and evaluated linear, tree-based, and neural network models for volatility prediction.
  • Conducted analysis, visualization, and interpretation of results, and contributed to the final project write-up.

How to Run

Dependencies: yfinance pandas numpy matplotlib seaborn scipy scikit-learn xgboost tensorflow tqdm lxml

About

Machine learning models to predict short-horizon stock volatility around earnings events using price, volume, and event-driven features.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages