Skip to content

EventStudyTools/matlab-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eventstudytools — MATLAB API wrapper

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.

Installation

Clone or download this repository and add it to your MATLAB path:

addpath('path/to/matlab-wrapper')

API key

Request your free API key at eventstudytools.com/api-key. Pass it to the constructor or set the EST_API_KEY environment variable.

Quickstart

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/.

Step-by-step API

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');

Parameters

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.

Input files

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

Result files

ar_results.csv, car_results.csv, aar_results.csv, caar_results.csv, analysis_report.csv, results_table_export.txt.

License

MIT

About

MATLAB client for the eventstudytools.com event study research API

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages