Updated 6/16 - The Event Study notebook has been completely revamped with help from Luca one of our community members. It's also been modularized, documented, and cleaned so you can tweak it to your specifications.
To run it you call run_event_study
with these parameters:
def run_event_study(event_data, date_column='asof_date',
start_date='2007-01-01', end_date='2014-01-01',
benchmark_sid='SPY', days_before=10, days_after=10, top_liquid=500,
use_liquid_stocks=True):
"""
Calculates simple & cumulative returns for events and plots stock price movement
before and after the event date.
Parameters
----------
event_data : pd.DataFrame
DataFrame that contains the events data with date and sid columns as
a minimum. See interactive tutorials on quantopian.com/data
date_column : String
String that labels the date column to be used for the event. e.g. `asof_date`
start_date, end_date : Datetime
Start and end date to be used for the cutoff for the evenet study
benchmark : string, int, zipline.assets._assets.Equity object
Security to be used as benchmark for returns calculations. See `get_returns`
days_before, days_after : int
Days before/after to be used to calculate returns for.
top_liquid : Int
If use_liquid_stocks is True, top_liquid determines the top X amount of stocks
to return ranked on liquidity
use_liquid_stocks : Boolean
If set to True, it will filter out any securities found in `event_data`
according to the filters found in `filter_universe`
"""
This event study looks at buyback announcements.