Skip to main content

EasyEventStudies

This package makes it easy to run event studies on financial assets. In contrast to other packages, it is easy to use, correct and allows for three different models of normal returns estimation. All calculations are based on the standard reference in the literature: The Econometrics of Financial Markets; John Y. Campbell, Andrew W. Lo and Craig MacKinlay (1998)

🎥 **Watch the Video Tutorial**

Video Tutorial

Get the detailed documentation here

Quick Start Guide

Install the package using pip:

pip install EasyEventStudies

Then import the package:

from EasyEventStudies import *

The run_event_study function runs a complete event study analysis for a financial asset and an event date. The package takes financial data from Yahoo Finance, so search for the ticker symbol of the asset you are interested on their website here. As an example, we will run an event study on British Petroleum (ticker: BP) on 15th of April, 2010. At this time, the Deepwater Horizon oil rig exploded.

results = run_event_study(
    ticker='BP',
    event_date='2010-04-20',
    estimation_window=[-100, -1],
    event_window=[0, 20],
    model_type="constant_model"
)
plot_CAR_over_time(results)

The event study shows that the explosion of the Deepwater Horizon oil rig was associated with a drop in the stock price of about 20 Percent in the first 20 days after the event.

More Detailed Documentation

The detailed documentation is available as a PDF. The package is based on the following two functions:

  1. The main function is run_event_study. It returns a pandas DataFrame with the results of the event study. Remember to specify the model you want to use to estimate normal returns.
def run_event_study(
    ticker: str,
    event_date: str,
    estimation_window: Tuple[int, int],
    event_window: Tuple[int, int],
    historical_days: int = 10,
    model_type: str = "market_model"
):
  • ticker: The ticker symbol from Yahoo Finance as a string (e.g., 'BA' for Boeing)
  • event_date: The date of the event in 'YYYY-MM-DD' format (e.g., '2019-03-08')
  • estimation_window: A tuple of two integers defining the time period used to estimate normal returns. The first number is the start of the window, the second is the end. For example, [-250, -1] uses the previous year's data.
  • event_window: A tuple of two integers defining the period for calculating cumulative abnormal returns. The first number is the start, the second is the end. For example, [0, 10] analyzes the 10 days following the event.
  • historical_days: Number of days before the event window to include in the output. This allows for plotting pre-event stock returns. Defaults to 10.
  • model_type: The model to use for estimating normal returns. Options are:
    • "market_model": Estimates returns as a function of market returns
    • "constant_model": Assumes constant normal returns
    • "three_factor_model": Uses the Fama-French three-factor model
  1. The plot_CAR_over_time function plots the cumulative abnormal returns over time. It takes the results of the run_event_study function as an input and plots the cumulative abnormal returns over time.
def plot_CAR_over_time(event_study_results,
                       days_before_event: int = 10, 
                       days_after_event: int = 10
                       ):
  • event_study_results: The results of the run_event_study function.
  • days_before_event: Number of days before the event window to include in the plot. Defaults to 10.
  • days_after_event: Number of days after the event window to include in the plot. Defaults to 10.

Citation

If you use this package in your work, please cite it as:

Roever, Nicolas (2024). EasyEventStudies: A Python Package for Event Studies. https://github.com/NicolasRoever/EasyEventStudies

Notes for Developer

Publishing the package:

  1. Delete the dist folder
  2. Update the version number in pyproject.toml
  3. Run python -m build
  4. Run python -m twine upload dist/*

Metadata

Release files for EasyEventStudies 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EasyEventStudies 2.0
File Size Uploaded Provenance Actions
easyeventstudies-2.0.tar.gz 13.4 kB Without provenance Details for easyeventstudies-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for EasyEventStudies 2.0
File Interpreter ABI Platform Actions
EasyEventStudies-2.0-py3-none-any.whl Python 3 none any Details for EasyEventStudies-2.0-py3-none-any.whl

Total release size: 25.9 kB

Release files / easyeventstudies-2.0.tar.gz

Download URL easyeventstudies-2.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
71bbf4f279f2324bc73f15e26267cd3ed4f881939fdcc7cbfabef5714578e561
BLAKE2b-256 checksum
How to use checksums
220188760a53a7e2196d9199292c901edafedd85062ed9bc68224d2773fe309c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.12

Release files / EasyEventStudies-2.0-py3-none-any.whl

Download URL EasyEventStudies-2.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0442ef29290c9431c6292e04ce724d25b6cb169fa2c1e1f8799619ef103974b
BLAKE2b-256 checksum
How to use checksums
b02ccb61749933a9c03669e72ac93fc2a5c05d0e7e25200392ccddea6e546765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.12

Security for EasyEventStudies 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page