Run abnormal-return event studies from MATLAB on the
eventstudytools.com research API:
EventStudyAPI uploads your data, runs the calculation on the server
and downloads the result files.
Pure MATLAB (matlab.net.http), no toolboxes required.
Works on MATLAB R2016b or newer.
Clone or download this repository and add it to your MATLAB path:
addpath('path/to/matlab-wrapper')Request your free API key at
eventstudytools.com/api-key.
Pass it to the constructor or set the EST_API_KEY environment
variable.
api = EventStudyAPI('YOUR_API_KEY');
files = struct( ...
'request_file', '01_RequestFile.csv', ...
'firm_data', '02_FirmData.csv', ...
'market_data', '03_MarketData.csv');
results = api.run(EventStudyAPI.arcParams(), files, 'results');
caar = readtable('results/caar_results.csv', ...
'FileType', 'text', 'Delimiter', ';');Sample data (20 US firms, S&P 500 benchmark) and a runnable script
live in examples/.
run() wraps the protocol steps; you can also drive them yourself:
api.authenticate();
api.configure(EventStudyAPI.arcParams('BenchmarkModel', 'ff3fm'));
api.upload('request_file', '01_RequestFile.csv');
api.upload('firm_data', '02_FirmData.csv');
api.upload('market_data', '03_MarketData.csv');
api.commit();
api.process();
results = api.downloadResults('results');EventStudyAPI.arcParams() accepts name-value pairs:
| Option | Values | Default |
|---|---|---|
BenchmarkModel |
mm, mm-sw, mam, cpmam, ff3fm, ffm4fm, ff5fm, garch, egarch, capm |
mm |
ReturnType |
log, simple |
log |
NonTradingDays |
later, earlier, keep, skip |
later |
ResultFileType |
csv, xls, xlsx, ods |
csv |
TestStatistics |
cellstr, see EventStudyAPI.testStatistics() |
six workhorse statistics |
avcParams() (abnormal volume) and avycParams() (abnormal
volatility) work the same way.
Semicolon-separated CSV files without header rows, dates as
dd.mm.yyyy:
- Request file: Event ID; Firm ID; Market ID; Event date; Grouping variable; Event window start; Event window end; Estimation window end; Estimation window length
- Firm data: Firm ID; Date; Closing price
- Market data: Market ID; Date; Index value
ar_results.csv, car_results.csv, aar_results.csv,
caar_results.csv, analysis_report.csv, results_table_export.txt.
MIT