calculate_payoffs: Calculate payoffs from trajectories

View source: R/calculate_payoffs.R

calculate_payoffsR Documentation

Calculate payoffs from trajectories

Description

The calculate_payoffs function calculate payoffs from trajectories

Usage

calculate_payoffs(paths, FUN, ...)

Arguments

paths

numeric matrix, price of the asset from different trajectories.

FUN

the function to be applied, payoff option: see 'Details' and 'Examples'.

...

arguments to FUN.

Details

FUN have to had parameter asset_price which represent price of the asset over the life of the option, see call_payoff

Arguments in ... cannot have the same name as any of the other arguments, and care may be needed to avoid errors.

Value

A numeric vector, option payoffs from different trajectories

Examples

X <- generate_scenarios(100, 0, 0.3)
calculate_payoffs(X, call_payoff, strike = 100)
calculate_payoffs(X, put_payoff, strike = 100)
## Example with asian call payoff
asian_call <- function(asset_price, strike){
  return(mean(asset_price) - min( mean(asset_price), strike ))
  }
calculate_payoffs(paths = X, option_modificate_payoff, const = 110, drift = 0.05, rate = 0, vol = 0.3, p = 1, asian_call, strike = 105)

mociepa/ShortfallRiskHedging documentation built on Sept. 30, 2022, 6:43 p.m.