Skip to content

EventStudyTools/python-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eventstudytools — Python API wrapper

Python client for the eventstudytools.com research apps: run abnormal-return event studies (and the other research apps) straight from Python. No third-party dependencies — standard library only, Python 3.8+.

Installation

pip install git+https://github.com/EventStudyTools/python-wrapper.git

API key

Request your free API key at eventstudytools.com/api-key. Pass it as EventStudyAPI("...") or set the EST_API_KEY environment variable.

Quickstart: abnormal-return event study (ARC)

from eventstudytools import EventStudyAPI, ARCInput

api = EventStudyAPI("YOUR_API_KEY")

results = api.run(
    ARCInput(benchmark_model="mm", return_type="log"),
    files={
        "request_file": "01_RequestFile.csv",
        "firm_data": "02_FirmData.csv",
        "market_data": "03_MarketData.csv",
    },
    dest_dir="results",
)

for rf in results:
    print(rf.name, "->", rf.local_path)

A complete runnable example with sample data (20 US firms, S&P 500 benchmark) lives in examples/.

Step-by-step API

run() wraps the five protocol steps; you can also drive them yourself:

api = EventStudyAPI("YOUR_API_KEY")
api.authenticate()                 # create task, obtain task token
api.configure(ARCInput())          # send analysis configuration
api.upload("request_file", "01_RequestFile.csv")
api.upload("firm_data", "02_FirmData.csv")
api.upload("market_data", "03_MarketData.csv")
api.commit()                       # server-side input validation
api.process()                      # launch calculation
api.download_results("results")    # poll + download

Input files

Semicolon-separated CSV files without header rows, dates as dd.mm.yyyy.

Request file (one row per event):

Column Content
1 Event ID (unique integer)
2 Firm ID (must match firm data)
3 Market/index ID (must match market data)
4 Event date (dd.mm.yyyy)
5 Grouping variable (for grouped AAR/CAAR results)
6 Event window start (e.g. -10)
7 Event window end (e.g. 10)
8 Estimation window end (e.g. -11)
9 Estimation window length (e.g. 120)

Firm data: Firm ID; Date; Closing priceMarket data: Market ID; Date; Index value.

Parameters (ARC)

Parameter Values Default
benchmark_model mm, mm-sw, mam, cpmam, ff3fm, ffm4fm, ff5fm, garch, egarch, capm mm
return_type log, simple log
non_trading_days later, earlier, keep, skip later
result_file_type csv, xls, xlsx, ods csv
test_statistics see eventstudytools.ARC_TEST_STATISTICS six workhorse statistics

Other research apps

  • AVCInput — abnormal volume calculator
  • AVyCInput — abnormal volatility calculator
  • CATAInput — content analysis (news analytics); uploads text_data + keywords_data
  • EDIInput — event date identification; uploads text_data

Result files (ARC)

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

License

MIT

About

Python 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