EventStudyAPI: APE Entry Point

EventStudyAPIR Documentation

APE Entry Point

Description

R interface for performing Event Studies on https://www.eventstudytools.com.

For more details see the help vignette: vignette("introduction_eventstudy", package = "EventStudy")

Format

R6Class object

Usage

For usage details see Methods, Arguments, and Examples sections.

Methods

new(apiServerUrl)

This method is used to create an object of this class with apiServerUrl as the url to the EventStudyTools server

authentication(apiKey)

This method is used to authenticate at apiServerUrl. A valid APIkey is required. You can download a free key on our website: https://www.eventstudytools.com

performEventStudy(estParam)

This method starts an Event Study. This method does all the analysis work for you

performDefaultEventStudy()

This method starts a default Event Study. It is a wrapper around performEventStudy

processTask()

This method starts the Event Study calculation on the server (after files are uploaded.

configureTask(input)

This method configures the Event Study. input is an ApplicationInputInterface R6 object, e.g. ARC configuration class

uploadFile(fileKey, fileName)

This method links to the file to upload. fileKey is the key of the file. Valid values are: request_file, firm_data, and market_data. fileName file name to upload.

commitData()

This method commits the data to the server

getTaskStatus()

Check if calculation is finished

getTaskResults(destDir = getwd())

Downloads the result files of the Event Study to destDir (Default: current working directory).

Arguments

eventstudyapi

An EventStudyAPI object

apiServerUrl

URL to the API endpoint

apiKey

Key for authentication

input

An ApplicationInputInterface object.

fileKey

Type of input file: request_file, firm_data, and market_data

fileName

Data filename

destDir

Directory for saving result files

Public fields

resultFiles

list of result files

dataFiles

list of data files

Methods

Public methods


Method new()

Class initialization

Usage
EventStudyAPI$new(apiServerUrl = NULL)
Arguments
apiServerUrl

url to API server


Method authentication()

Usage
EventStudyAPI$authentication(apiKey = NULL)
Arguments
apiKey

EST API key


Method performEventStudy()

Performs an event study with given parameters and files.

Usage
EventStudyAPI$performEventStudy(
  estParams = NULL,
  dataFiles = c(request_file = "01_RequestFile.csv", firm_data = "02_firmData.csv",
    market_data = "03_MarketData.csv"),
  destDir = "results",
  downloadFiles = T,
  checkFiles = F
)
Arguments
estParams

A class of type ARCApplicationInput. This class contains the definition of the event study.

dataFiles

A named vector for the input files.

destDir

Destination dir of event study results.

downloadFiles

Boolean parameter for downloading files from server.

checkFiles

Check input files.


Method performDefaultEventStudy()

Performs an event study with default parameters and files.

Usage
EventStudyAPI$performDefaultEventStudy(
  estType = "arc",
  dataFiles = c(request_file = "01_RequestFile.csv", firm_data = "02_firmData.csv",
    market_data = "03_MarketData.csv"),
  destDir = "results",
  downloadFiles = T,
  checkFiles = F
)
Arguments
estType

A string (arc, avc, or avyc) that is used to initialize the default parameter set.

dataFiles

A named vector for the input files.

destDir

Destination dir of event study results.

downloadFiles

Boolean parameter for downloading files from server.

checkFiles

Check input files.


Method processTask()

Process the task. Internal use.

Usage
EventStudyAPI$processTask()

Method configureTask()

Configure the task. Internal usasge.

Usage
EventStudyAPI$configureTask(estParams = NULL)
Arguments
estParams

An object of class EventStudyApplicationInput


Method uploadFile()

Upload files to server. Internal usage.

Usage
EventStudyAPI$uploadFile(fileKey, fileName, partNumber = 0)
Arguments
fileKey

File key

fileName

File name

partNumber

PArt number of the file


Method deleteFileParts()

Delete files. Internal usage.

Usage
EventStudyAPI$deleteFileParts(parts)
Arguments
parts

Parts


Method splitFile()

Split files Internal usage.

Usage
EventStudyAPI$splitFile(fileName, maxChunkSize)
Arguments
fileName

File name

maxChunkSize

Max chunk size.


Method get_token()

Get token. Internal usage.

Usage
EventStudyAPI$get_token()

Method commitData()

Commit data. Internal usage.

Usage
EventStudyAPI$commitData()

Method getTaskStatus()

Fetch task status. Internal usage.

Usage
EventStudyAPI$getTaskStatus(exceptionOnError = FALSE)
Arguments
exceptionOnError

Throw exception on errpr.


Method getTaskResults()

Fetch results Internal usage.

Usage
EventStudyAPI$getTaskResults(downloadFiles = T, destDir = getwd())
Arguments
downloadFiles

Download files

destDir

Destination dir


Method getApiVersion()

Get API version.

Usage
EventStudyAPI$getApiVersion()

Method clone()

The objects of this class are cloneable with this method.

Usage
EventStudyAPI$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Not run: 
apiKey <- "{Please insert your aPI key here}"

The URL is already set by default
options(EventStudy.KEY = apiKey)

# initialize object
estSetup <- EventStudyAPI$new()

# get S&P500 example data
getSP500ExampleFiles()

# set Event Study parameters
estType <- "arc"
dataFiles <- c("request_file" = "01_RequestFile.csv", 
               "firm_data"    = "02_firmData.csv", 
               "market_data"  = "03_MarketData.csv")
resultPath <- "results"

# Perform Event Study 
estResult <- estSetup$performDefaultEventStudy(estType    = estType,
                                               dataFiles  = dataFiles, 
                                               destDir    = resultPath)

## End(Not run)

EventStudyTools/api-wrapper.r documentation built on April 16, 2023, 1:04 p.m.