1 | wrap(score, Cno)
|
score |
|
Cno |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (score, Cno)
{
returns <- diff(log(data)) + 1
names(tmp) <- colnames(data)
if (score < 120) {
risk <- "Low"
}
if (score >= 120 && score < 140) {
risk <- "Medium"
}
if (score > 140) {
risk <- "High"
}
ETFs <- Selector(returns, risk, Cno)
b.test <- backtest(returns, risk, Cno)
stats <- sumstat(b.test, ETFs)
col.info <- as.character(tmp[ETFs])
names(col.info) <- ETFs
output <- list()
output[[1]] <- ETFs
output[[2]] <- rep(1/length(ETFs), length(ETFs))
output[[3]] <- col.info
output[[4]] <- names(b.test)
output[[5]] <- b.test
output[[6]] <- names(stats)
output[[7]] <- stats
out <- JSON.OBJ(output)
return(out)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.