From 10c210e06db3cd0822a2186657321f2d3b14ba57 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Sun, 1 May 2016 20:13:51 +0200 Subject: [PATCH] Add history to the contract class --- R/InsuranceContract.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/R/InsuranceContract.R b/R/InsuranceContract.R index 35dd452..a7c999f 100644 --- a/R/InsuranceContract.R +++ b/R/InsuranceContract.R @@ -48,6 +48,11 @@ InsuranceContract = R6Class( premiumComposition = NA ), + #### Keeping the history of all contract changes during its lifetime + history = list( + + ), + #### The code: @@ -80,6 +85,11 @@ InsuranceContract = R6Class( self$recalculate(); }, + addHistorySnapshot = function(time=0, comment="Initial contract values", type="Contract", params=self$params, values = self$values) { + self$history = c(self$history, + list("time"=time, "comment"=comment, "type"=type, "params"=params, "values"=values)); + }, + recalculate = function() { self$determineTransitionProbabilities(); self$determineCashFlows(); -- GitLab