Questions tagged [r-portfolioanalytics]

PortfolioAnalytics is an R package for portfolio analysis, including numerical methods for optimization of portfolios.

PortfolioAnalytics is an R package for portfolio analysis, including numerical methods for optimization of portfolios.

83 questions
8
votes
2 answers

Custom expected returns in the Portfolio Analytics package

I have trouble incorporating custom expected returns in Portfolio Analytics package. Usually expected returns are some professional expectations / views or calculated separately from fundamental indicators. Portfolio Analytics allow to create custom…
Hakki
  • 1,440
  • 12
  • 26
6
votes
1 answer

Maximum number of assets in R package 'performanceanalytics' optimizer

This is just a general question regarding the maximum number of stocks I can use in the r performanceanalytics optimizer function. My code works fine for optimizing anything up to around 110 assets but anything exceeding that gives an error. I…
5
votes
0 answers

PortfolioAnalytics - ROI optimize.rebalancing using redenominated monthly prices produces incorrect result?

Hope that someone could help or has experienced a similar situation to point me in the direction of what is going wrong. Here is my setup (see hopefully reproducible code further below): build a list of symbols get instrument data via…
4
votes
1 answer

Create efficient frontier in PortfolioAnalytics without an xts object

Is there a way to create an efficient frontier in the PortfolioAnalytics package without specifying an xts object of asset returns? Instead I'd like to supply the vector of expected returns and the covariance matrix.
3
votes
2 answers

Portfolio Optimize in R with ONLY a vector of mean returns and covariance matrix

Every package that I look at seems to require time series returns for my assets. For example I like the PortfolioAnalytics package, and I require many of the constraints offered (box constraints, group constraints, etc.). However, as far as I can…
3
votes
1 answer

Error when trying to optimize with Portfolio Analytics

I'm trying to copy the code from a website to test Portfolio Analytics library in R. But I getting an error and I don't have a clue why. The error I am getting is: Error: "package:ROI" %in% search() || requireNamespace("ROI", quietly = TRUE) is not…
renatomt
  • 288
  • 2
  • 11
2
votes
0 answers

How to scrape from investing.com using 'rusquant' package in R

I posted a similar question before [the question is closed now, I deleted it]. From that I came to know about 'rusquant' package. I thank the person who introduced me to the package 'rusquant' here. I tried the following codes in several…
ti.jaheed
  • 21
  • 2
2
votes
0 answers

Maximum Sharpe Ratio portfolio fails with error in PortfolioAnalytics

I have come across an issue in PortfolioAnalytics when calculating simple Maximum Sharpe Ratio portfolio weights: Error in max_sr_opt(R = R, constraints = constraints, moments = moments, : Objective function failed with message Error in…
Samo
  • 2,065
  • 20
  • 41
2
votes
0 answers

Portfolio Analytics with a predefined return and cov-matrix

I'm using PortfolioAnalytics in r and trying to use a predefined covariance and returns matrix. For example, the estimated returns from my assets are returns <- matrix(c(0.316, 0.322, 0.288), ncol = 3) And a possible covariance matrix is…
2
votes
0 answers

What is the fastest way to solve portfolio optimization problem in R?

I am looking at how to implement Modified Sharpe Ratio optimization in R in the most performant/fastest way. Modified Sharpe Ratio (MSR) as I define it for this problem is MSR = r/(sd^f) (where r is return of particular asset, sd is standard…
2
votes
1 answer

PortfolioAnalytics error while creating efficient frontier

I'm trying to run portfolio optimization problems, everything runs smoothly, except when I try to create the efficient frontier. I've tried to mess around with all the function parameters, I've installed all packages and plugins recommended by the…
Omar Omeiri
  • 1,506
  • 1
  • 17
  • 33
2
votes
1 answer

Error in setting portfolioanalytics box constraints

Let's see if I can get this solved with your help. It seems that the R package PortfolioAnalytics used to optimise a portfolio has a bug. It is most likely me, but to be sure I want to see if anyone else ran into the same issue and possibly a…
Aaron Soderstrom
  • 599
  • 1
  • 6
  • 12
1
vote
0 answers

Why does PortfolioAnalytics return the same portfolio for different asset return moments (without errors), with "boudt"-moments not working at all?

I tried to backtest different portfolio optimization methods with the “PortfolioAnalytics” package in R. First, I ran the “standard” optimization method, and then optimizing with two different robust estimates for the variance-covariance matrix of…
JB97
  • 11
  • 2
1
vote
0 answers

Solving Portfolio Optimization with two constraints

total_amount <- 1000000 df <- data.frame("price"= c(226,186,456,615,549), "firms"= c("VRSN","TXN","DPZ","IDXX","ORLY")) FUN <- function(q, price=df$price){ total <- sum(price * q) errs <- c( (total-total_amount)^2, ( (…
1
vote
0 answers

How to get the weights on the tangency portfolio using R package PortfolioAnalytics

I am trying to use the R PortfolioAnalytics package to compute the weights of the tangency portfolio for the efficient frontier when there is access to a risk free asset. An interesting and replicable experiment is shown below using the edhec…
Geoff S
  • 175
  • 2
  • 13
1
2 3 4 5 6