Skip to content
Snippets Groups Projects
Commit feeb49e7 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Allow arbitrary balance sheet reserve interpolation method (by passing a...

Allow arbitrary balance sheet reserve interpolation method (by passing a function for the balanceSheetMethod parameter)
parent bbfa882a
Branches
Tags
No related merge requests found
......@@ -255,7 +255,11 @@ InsuranceContract.Values = list(
#' month are relevant.}
#' \item{\code{$balanceSheetMethod}}{How to interpolate the balance sheet
#' reserves (at the balandeSheetDate) from the yearly contractual
#' reserves.}
#' reserves. Either a string "30/360", "act/act", "act/360", "act/365"
#' or a function with signature \code{balanceSheetMethod(params, contractDates, balanceDates)}
#' that returns a vector of coefficients for each year to
#' interpolate the reserves available at the given \code{contractDates}
#' for the desirec \code{balanceDates}}}
#' \item{\code{$surrenderValueCalculation}}{A function describing the surrender
#' value calculation.}
#' \item{\code{$premiumFrequencyOrder}}{Order of the approximation for
......
......@@ -1082,7 +1082,9 @@ InsuranceTarif = R6Class(
contractDates = params$ContractData$contractClosing + years(1:years);
balanceDates = balanceDate + years(1:years - 1);
if (params$ActuarialBases$balanceSheetMethod == "30/360") {
if (is.function(params$ActuarialBases$balanceSheetMethod)) {
baf = params$ActuarialBases$balanceSheetMethod(params = params, contractDates = contractDates, balanceDates = balanceDates)
} else if (params$ActuarialBases$balanceSheetMethod == "30/360") {
baf = ((month(balanceDates + days(1)) - month(contractDates) - 1) %% 12 + 1) / 12
} else if (params$ActuarialBases$balanceSheetMethod == "act/act") {
baf = as.numeric((balanceDates + days(1)) - contractDates, units = "days" ) / as.numeric(balanceDates - (balanceDates - years(1)), units = "days")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment