Risk Constraint in PortfolioAnalytics- Portfolio Optimazation(Stocks)

data_science

#1

Can some one help me on the below ?

1)How to add risk constraint in PortfolioAnalytics?
I have tried adding the return as constraint,risk as objective function and its working fine. Can’t we do return as objective function and risk as constraint ?

  1. when i execute this code, i got the below result and would need help here to interpret the output .
    p <- portfolio.spec(assets = c(“WST”,“HDB”,“PAM”,“CRL”,“JPM”))
    p<- add.constraint(p, type = “box”, min = 0.05, max = 0.8)
    p <-add.constraint(portfolio = p, type = “full_investment”)
    maxret.port <- add.objective(p, type = “return”,name = “mean”)
    minvar.port <- add.objective(maxret.port, type = “risk”, name = “var”)
    minvar.port <- optimize.portfolio(returns.data, minvar.port, optimize_method = “ROI”)
    minvar.port

image