R/testInvest.R

testInvest <- function() {
  # invFunc <- function(prevTransfert)
  # {
  #   return(constInvest(prevTransfert,
  #                      1.)) # 0 investment made
  # }
  
  #' 3000 euros are spent each. What is invested is what remains after interrest and insurance have been paid.
  #' 
  #' @param prevTransfert dummy argument, because the investment is fixed.
  invFunc <- function(prevTransfert)
  {
    return(varInvest(prevTransfert,
                     3000.)) # investment made up to this amount
  }
  
  termFunc <- termOnMonth
  rate <- 2.2/100./12
  
  res.low.noInvest <- loanInvest(200, # maxMonth
                                 rate, # loanRate
                                 1350.,# loanTransfer
                                 160000.,# loanCapital
                                 rate, # investRate
                                 0., # investCapital
                                 invFunc, # invFunc
                                 termFunc) # termFunc
  
  res.low.invest <- loanInvest(200, # maxMonth
                               rate, # loanRate
                               1350.,# loanTransfer
                               160000. - 40000.,# loanCapital
                               rate, # investRate
                               40000., # investCapital
                               invFunc, # invFunc
                               termFunc) # termFunc
  
  res.high.noInvest <- loanInvest(200, # maxMonth
                                  rate, # loanRate
                                  2000.,# loanTransfer
                                  160000.,# loanCapital
                                  rate, # investRate
                                  0., # investCapital
                                  invFunc, # invFunc
                                  termFunc) # termFunc
  
  res.high.invest <- loanInvest(200, # maxMonth
                                rate, # loanRate
                                2000.,# loanTransfer
                                160000. - 40000.,# loanCapital
                                rate, # investRate
                                40000., # investCapital
                                invFunc, # invFunc
                                termFunc) # termFunc
}
vkubicki/rfinance documentation built on May 14, 2019, 7:22 p.m.