Skip to main content

All Questions

Filter by
Sorted by
Tagged with
8 votes
2 answers
3k views

Random Portfolios vs Efficient Frontier

I understand the concept of the efficient frontier and am able to calculate it in Python. But even when generating 50'000 random 10 asset portfolios, the single portfolios are not even close to the ...
R. Steigmeier's user avatar
6 votes
4 answers
698 views

R: Book with extensive examples for either portfolio optimization or volatility forecasting?

I'm at a new job and there's the option to use R (you don't have to, but I'd like to). I used R years ago, so I while I'm somewhat familiar with it, I have forgotten most of it. For me, the best ...
NoNameNo123's user avatar
6 votes
2 answers
660 views

Matlab Portfolio Optimization with bid ask spread

I'm trying to find the optimal portfolio of options and stock which minimizes the standard deviation of the portfolio returns but also taking into consideration the bid and ask prices of the assets. ...
Michael Watters's user avatar
5 votes
3 answers
4k views

Compute tangency portfolio with asset allocation constraints

I am looking to compute the tangency portfolio of the efficient frontier, but taking into account min_allocations and ...
cpage's user avatar
  • 84
5 votes
1 answer
4k views

constrained portfolio optimization by fmincon

I am working through this paper, http://www.nber.org/papers/w8922.pdf I want to implement the portfolio weight constraints see page 6-7. Here is the brief overview of my problem: Let ...
active's user avatar
  • 71
5 votes
1 answer
1k views

Portfolio Optimization using Parametric Portfolio Policy Method in MATLAB

I want to contruct an optimized stock portfolio with the restriction of a zero-investment strategy. The portfolio weight in each stock needs to be modeled as a function of state variables (factors ...
Nourhaine Nefzi's user avatar
4 votes
3 answers
1k views

Sampling problem in portfolio optimization

In a summary I am trying to do the following Bond Subset 1 : Get list of USD Bonds --> Filter out Bonds which have YTM > y% DUR > 10 Y etc. .. This gives us Bonds which we are interested in. So in ...
ash's user avatar
  • 921
4 votes
1 answer
374 views

PortfolioAnalytics and regime switching issue

I've been playing around with the R package PortfolioAnalytics and I have spent more time than I'm willing to admit to try and resolve this issue: When I follow the regime switching example with the ...
AtoZ's user avatar
  • 41
4 votes
2 answers
1k views

Optimal Portfolio from Efficient Frontier

I found this code on plotly site, using CVXOPT to find the efficient frontier, and then, the optimal Portfolio. The optimal function is ...
user1919071's user avatar
3 votes
2 answers
889 views

Find k of n assets that "minimize" the correlation matrix

I'm trying to find an efficient way to select $k$ from $n$ risky assets that are the least correlated with each other. I know that I can perform a brute-force search of all $k$-sized combinations of ...
geofflittle's user avatar
3 votes
2 answers
513 views

How to add the effect of skewness in the portfolio optimisation objective function?

I have the following risk adjusted portfolio which I optimise, where gamma is the risk return trade off, $r$ are the returns and $C$ is the covariance matrix which considers scenarios, so it is not ...
Luigi87's user avatar
  • 326
3 votes
1 answer
6k views

Mean Variance portfolio optimisation (Long Only) CVXPY including cardinality constraint

I am working on a portfolio optimisation that requires me to constrain on the number of assets used, e.g from S&P500 build a 20 asset portfolio that is feasible. After doing some research I came ...
ThatQuantDude's user avatar
3 votes
2 answers
1k views

How to perform portfolio optimization with user-defined expected return and variances using R?

I found some functions for Markowitz mean variance portfolio optimization in R such as portfolio.optim in tseries package. ...
HasnainMamdani's user avatar
3 votes
2 answers
2k views

Is my python solution good? : Global Minimum Variance portfolio with 'no-short sale' constraint

Question Is my python code an answer (at least a close answer) to get the weight vector of the Global Minimum Variance portfolio problem? My codes are shown below after some explanations. Details to ...
Eiffelbear's user avatar
3 votes
1 answer
487 views

Portfolio Optmization With Risk Aversion Parameter R

I have this problem in R. $$\max w^Tu- y w^T A w$$ where A is covariance variance matrix, y risk aversion parameter. Is it rigth if I use the function solve.QP multiplying the covariance matrix for ...
Elisa Ballestrelli's user avatar
3 votes
1 answer
2k views

Portfolio Analytics Optimization

I have a large dataset, 10,000 investments I am trying to create an optimized portfolio for. The portfolio has 3 restrictions. Long Only, Only 50 assets can be selected and every invested asset has ...
JB17's user avatar
  • 41
3 votes
1 answer
244 views

Why is this utility function not picking up its penalty?

I was reading this seminal paper by Infanger. On page 40, Figure 11. was quite interesting. In particular I was interested in the top one, 19 Years and I wanted to reproduce this plot. To give some ...
math's user avatar
  • 1,770
3 votes
0 answers
489 views

What R-packages for SOCP problems are there?

Currently, I am looking deeper into the topic of second-order cone programming. Could you suggest packages that solve SOCP-problems in R? With your answer, please provide a short description of ...
vanguard2k's user avatar
  • 2,935
2 votes
3 answers
2k views

Regularizers to compute Minimum Variance Portfolio weights

I need to compute the mimimum variance portfolio using different regularizers, to compare the results and use validation methods to find the optimal parameters. Currently my work has been performed ...
Hiru's user avatar
  • 103
2 votes
1 answer
4k views

How to calculate Sortino ratio from a weighted portfolio with Python?

In this working example I'm able to calculate a Sharpe ratio (with rf=0) from a weighted portfolio of 3 securities, but how can I modify the code bellow so it calculates a Sortino ratio ? ...
Florent's user avatar
  • 241
2 votes
1 answer
5k views

Why optimize.portfolio in R package PortfolioAnalytics is not working?

I used the R-package PortfolioAnalytics for portfolio optimization. In the portfolio optimization part. I used the function optimize.portfolio to set up my optimization. However, here was the error ...
KW_IVDD's user avatar
  • 21
2 votes
2 answers
2k views

How many years of historical data is require for Portfolio Optimization?

I would like to know about below questions. How many years of historical data is require for Portfolio Optimization in R programming. Thanks Atul
Atul Agarawal's user avatar
2 votes
2 answers
7k views

Calculating the efficient frontier from expected returns and SD

I'm trying to calculate the efficient frontier (and the optimal portfolio at the Sharpe ratio) given two vectors for a portfolio: (1) expected returns and (2) historical standard deviations. I would ...
itpetersen's user avatar
2 votes
1 answer
502 views

Objective function: as close to equal weight as possible

I am having trouble coming up with a function to optimize the weights to be as equal as possible. It is a long-short portfolio with 6 positions weights is a cvx variable: [long, long, short, short, ...
Jamulive's user avatar
2 votes
1 answer
4k views

Turnover as a soft constraint for portfolio optimization

I am using cvxpy to do a simple portfolio optimization. I implemented the following dummy code ...
ThatQuantDude's user avatar
2 votes
1 answer
3k views

How to calculate the global minimum variance portfolio in R?

I am attempting to use the globalMin.portfolio command to calculate the global minimum variance portfolio in RStudio. My code is as follows (note that several ...
percy's user avatar
  • 23
2 votes
3 answers
3k views

Portfolio Optimization - Zero beta portfolio

I am trying to solve a optimization portfolio in R in which I do the following constraints: Set weight sum to within a boundary Set return to a certain value Set portfolio beta to 0 The purpose is ...
Artur Silva's user avatar
2 votes
4 answers
330 views

Cant replicate minimum variance portfolio variance by simulating many random portfolios in R

I have computed the theoretical minimum variance portfolio using the 30 stocks in the Dow. The formula used is: $$\underset{N\times 1}{\omega_{mvp}}=\frac{\lambda}{2}\cdot \Sigma^{-1}\iota=\frac{\...
Emil Bille's user avatar
2 votes
1 answer
3k views

What is optimize.portfolio.rebalancing in R-package PortfolioAnalytics calculating?

I recently started using the R-package PortfolioAnalytics for performing some portfolio optimization. And I'm trying to get a grasp on what exactly the function <...
Marcus C.'s user avatar
  • 153
2 votes
2 answers
872 views

Dealing with a constraint which is the square root of a quadratic form

I'm trying to maximize my portfolio, but don't know how to deal with the constraint which is on the form max $2u^Tx-x^T \Sigma x$ Subject to $e^Tx = 1$ $u^Tx - m (x^T \Sigma x)^{1/2} >= c $ ...
user19265's user avatar
2 votes
1 answer
661 views

Equall Risk Contribution and The Most Diversified Portfolio [closed]

I am a master degree student on applied economics at Brazil and my thesis will be about smart beta strategies. I pretend to apply Equal Weigth, Mininum Variance, Most Diversified Portfolio and Equal ...
Gabriel Wadih's user avatar
2 votes
1 answer
2k views

short-sale constraint with nonpositive-definite matrix in portfolio optimization

I need help about portfolio optimization in R. I have inverted matrix and I want to use it as an input in portfolio optimization. It was non-positive definite before I have handled it. In portfolio ...
user13895's user avatar
2 votes
1 answer
2k views

Minimum variance portfolio in Python

I have a portfolio or $N$ assets in $t=10$ days. ...
user avatar
2 votes
0 answers
201 views

Can genetic algorithm help in portfolio optimisation when convexity is not verifiable

I have the following portfolio cost function to maximise: $$ w^T\mu-\frac{1}{2}\gamma w^T\Sigma w+\frac{1}{6}\gamma^2 w^TM_3(w\otimes w), $$ which considers the co-skewness ($M_3$ tensor), $γ$ is the ...
Luigi87's user avatar
  • 326
2 votes
0 answers
74 views

Why can't I take the Value at Risk "VaR" as a a risk objective in PerformanceAnalytics? (it does work for "ES)

I am currently playing around with PortfolioAnalytics package in R and some data and I am aiming to create different portfolios with different VaR. However, I am struggling first of all, add.objective(...
brko's user avatar
  • 21
2 votes
0 answers
44 views

fPortfolio specify our constraints for efficientPortfolio [closed]

I am working on the library fPortfolio in R and I have a question. How can we fix for a portfolio the sum of weights equal to 1 ? When I study the code, I see that we cannot choose which constraints ...
David Lewin's user avatar
2 votes
0 answers
113 views

VaR calculation using excel gives different value than VaR using R at all c values except at c=0.5

This is VaR calculation in excel using variance-covariance method. This is VaR calculation in R. ...
knowrahulj's user avatar
2 votes
0 answers
729 views

Optimal weights for portfolio optimisation (r)

The question is what R optimization could be applicable to find a vector of weights that when, multiplied by S matrix creates equal rows sums, and when set in the objective function returns the ...
user2948605's user avatar
2 votes
0 answers
410 views

Optimize a trading strategy created in excel with R

I have created quite a complex back test in excel spanning 15 years with 17 parameters. I would like to optimize the parameters which would give me maximum return given a maximum draw-down percentage. ...
Vinay Bharath's user avatar
1 vote
2 answers
460 views

Portfolio optimisation - Non brute force solutions to optimisation problems

Recently I wrote a program in Python which extracts stock data for a designated period and frequency of the predetermined stocks and then optimises the portfolio using the Sharpe ratio. In order to ...
Noir's user avatar
  • 257
1 vote
2 answers
6k views

portfolio optimization with weights constraint in python

I'm trying to optimize a portfolio using cvxpy. My original construction is the following: ...
Michael's user avatar
  • 500
1 vote
1 answer
168 views

Bond portfolio optimization with Python reaching iteration limit

I am using scipy to optimize a hypothetical bond portfolio for maximum yield by choosing from a list of bonds in the portfolio's investable universe while adhering to portfolio constraints such as ...
user74843's user avatar
1 vote
1 answer
248 views

Ridge and Quadratic Programming for Portfolio Norm Optimization

Much like this post: https://stats.stackexchange.com/questions/119795/quadratic-programming-and-lasso, I'm trying to integrate RIDGE Penalty in a dedicated quadratic solver. In my case, I am working ...
Samuel Normandeau's user avatar
1 vote
1 answer
294 views

Portfolio/sub-portfolio optimization

I have a finite amount of 26 assets, the total amount of these assets needs to be allocated to 9 portfolios. Each portfolio has its own required return which needs to be met, using a min-variance ...
uhrskov91's user avatar
1 vote
1 answer
766 views

Why am I getting nan returns from PyPortfolioOpt package

...
William Reid's user avatar
1 vote
1 answer
1k views

Implementing the Sharpe's return-based style analysis on Python

I am trying to implement the Sharpe's return-based style analysis on Python. The problem is formulated as follows: ...
JungleDiff's user avatar
1 vote
1 answer
690 views

constrained portfolio optimization in matlab

I am working through this paper, http://www.nber.org/papers/w8922.pdf I want to implement the portfolio weight constraints see page 6-7. Here is the brief overview of my problem: Let ...
user13895's user avatar
1 vote
2 answers
114 views

Reverse Optimization: finding the returns that satisfy specific weights given one known return

Here is the premise: I have a three asset portfolio, I know the assets covariance, the client's risk aversion and the expected return of one of the assets. I also have a desired set of weights. So, 1) ...
Farrep7's user avatar
  • 21
1 vote
1 answer
245 views

Reverse optimization: How to generate the expected portfolio returns given the weights and a series of constraints on those weights?

I have the below function in Python. My objective is to back out the expected returns associated with certain portfolio weights given a series of assumptions. From this I want to generate the expected ...
Farrep7's user avatar
  • 21
1 vote
1 answer
397 views

cvxpy Portfolio Optimization

I am trying to understand which is the best way to construct the parameters using the cvxpy engine. I have seen this post: more of list-like way of constructing constraints etc and this post: more ...
wanna_be_quant's user avatar