Nothing
library(CVXR)
# Markowitz mean-variance
portfolio_fun <- function(data, ...) {
X <- as.matrix(diff(log(data$adjusted))[-1])
mu <- colMeans(X)
Sigma <- cov(X)
lmd = 0.5
w <- Variable(nrow(Sigma))
prob <- Problem(Maximize(t(mu) %*% w - lmd*quad_form(w, Sigma)),
constraints = list(w >= 0, sum(w) == 1))
result <- solve(prob)
return(as.vector(result$getValue(w)))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.