Description Usage Arguments Value References Examples
Optimizes a portfolio using the linear programming solver Rglpk.
1 | solveRglpk(data, spec, constraints)
|
data |
a time series or a named list, containing either a series of returns or named entries 'mu' and 'Sigma' being mean and covariance matrix. |
spec |
an S4 object of class |
constraints |
a character string vector, containing the constraints of the form |
a list with the following named ebtries:
solver
,
optim
,
weights
,
targetReturn
,
targetRisk
,
objective
,
status
,
message
.
Wuertz, D., Chalabi, Y., Chen W., Ellis A. (2009); Portfolio Optimization with R/Rmetrics, Rmetrics eBook, Rmetrics Association and Finance Online, Zurich.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## data -
Data = SMALLCAP.RET
Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
Data
## spec -
Spec = portfolioSpec()
setType(Spec) = "CVaR"
setSolver(Spec) = "solveRglpk"
setTargetReturn(Spec) = mean(Data)
Spec
## constraints -
Constraints = "LongOnly"
## solveRglpk -
solveRglpk(Data, Spec, Constraints)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.