tests/testthat/test-riskparity_screen.R

#
# test-riskparity_screen.R
# ------------------------
#
#
library(ResilientPortfolio)
library(testthat)

context("Testing riskparity_screen")

test_that("Testing riskparity_screen function", {

  library(ResilientPortfolio)
  prices           <- xts_data[, 1:8]
  riskpar_feature  <- "sd63"
  momfeature       <- "mom84"
  ########

  rpslist <- riskparity_screen(prices, maxweights = 0.5,
                               riskpar_feature    = riskpar_feature,
                               riskpar_thresh     = 0.15,
                               momfeature         = momfeature,
                               absmom_thresh      = 0.0,
                               cashasset          = "BND",
                               Nassets            = 3,
                               return_matrices    = TRUE)

  maxwtsmat <- rpslist$max_weights
  mommat    <- rpslist$momentum_mat
  volmat    <- rpslist$volatility_mat

  print(head(maxwtsmat, 10))
  print(head(mommat, 10))
  print(head(volmat, 10))



})
jeanmarcgp/ResilientPortfolio documentation built on April 8, 2018, 5:43 p.m.