Skip to contents

Base (abstract) class for return calculation strategies. Subclass this to plug a custom return calculation into prepare_event_study() / EventStudyTask$new() via ParameterSet$return_calculation.

A subclass must implement calculate_return(tbl, in_column, out_column): given a tibble of prices in in_column, add a column named out_column with the calculated return (e.g. simple or log return). See SimpleReturn and LogReturn for reference implementations.

Public fields

name

Name of the return calculation.

Methods


ReturnCalculation$calculate_return()

Calculates the return for a single stock.

Usage

ReturnCalculation$calculate_return(
  tbl,
  in_column = "adjusted",
  out_column = "adjusted_return"
)

Arguments

tbl

The dataframe with the stock price.

in_column

The column name of the price infromation.

out_column

The column name were the return will be saved.


ReturnCalculation$clone()

The objects of this class are cloneable with this method.

Usage

ReturnCalculation$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.