payoff_ratchet: Ratchet payoff class

Description Usage Format Value Methods Examples

Description

Class providing a ratchet payoff object. The payoff will be the highest account value recorded at some specified times.

Usage

1

Format

R6Class object.

Value

Object of R6Class

Methods

new

Initialize method. The arguments are a non negative scalar with the premium and the ratchet frequency. Allowed units for the frequency are "m" for 4 weeks, "w" for weeks, "d" for days

set_premium

Stores the premium in a private field. The argument is a non negative scalar

get_premium

Returns the premium as non negative scalar

set_freq

Sets the ratchet frequency. Allowed units for the frequency are "m" for 4 weeks, "w" for weeks, "d" for days

get_payoff

Gets the payoff. The arguments are a numeric vector with the amounts, a vector of timeDate objects with the start and end dates for the ratchet and a numeric vector with the account values. (see Examples)

Examples

1
2
3
4
5
6
7
freq <- "1m"
premium <- 100
ratchet <- payoff_ratchet$new(premium, freq)
t1 <- timeDate::timeDate("2016-01-01")
t2 <- timeDate::timeDate("2016-12-31")
account <- 120 * rnorm(365)
ratchet$get_payoff(c(120,100), c(t1,t2), account)

IvanZoccolan/valuer documentation built on May 7, 2019, 6:45 a.m.