A fully functional backtest of a Post-Earnings Announcement Drift (PEAD) long-short trading strategy. Developed as part of my Bachelor's thesis at the University of Zurich (Major in Banking & Finance, Minor in Computer Science).
The strategy systematically trades stocks based on quarterly earnings surprises (SUE scores). It implements:
- Event-based signal generation using SUE thresholds
- Rule-based long-short execution logic
- Backtest engine with daily tracking and benchmark comparison (S&P 500)
- Performance metrics: Sharpe ratio, Jensen’s alpha, Beta, Total and Annualized Return
- Transaction cost modeling using bid-ask spreads
- Python 3.8+
- WRDS access (for data)
- macOS or Windows (tested on both)
./run.shDouble-click run.bat or execute:
run.batThis will:
- Set up a Python virtual environment
- Install all dependencies
- Run the full backtest (
src/pead_strategy.py)
After completion, the script:
- Prints a summary of results to the terminal
- Saves a
.txtsummary in theoutput/directory - Shows a plot comparing portfolio vs. benchmark performance
The backtest covers the 30 year period from January 1994 to December 2023.
Theoutput/folder contains the full result summary as a.txtfile and the equity curve plot comparing the PEAD strategy against the benchmark.
The data/ folder is intentionally left empty due to GitHub file size limits and licensing restrictions.
The datasets were obtained from four different sources:
- IBES (via WRDS): Quarterly earnings announcement data, including actual EPS, the mean and standard deviation of analyst estimates, announcement dates, and tickers.
- CRSP (via WRDS): Daily adjusted prices, bid and ask prices, and historical S&P 500 constituent membership. Used for returns, transaction cost modeling, and universe construction.
- Compustat (via WRDS): Complementary daily stock prices to fill missing values in CRSP, SIC industry codes for sector analysis.
- Yahoo Finance: Daily adjusted close prices for the SPDR S&P 500 ETF Trust (SPY), used as the benchmark.
The full earnings dataset contains 95,748 announcements for 1,337 stocks that have been part of the S&P 500 between 1994 and 2023. Daily prices are adjusted for splits, dividends, and mergers.
These datasets are sourced from WRDS and Yahoo Finance. WRDS data is subject to licensing restrictions and must not be redistributed.
If you are affiliated with a university, you may have access via WRDS.
Otherwise, contact the author to request a minimal demo dataset for evaluation purposes.
This project is released under the MIT License (see LICENSE).