New answers tagged

1

Do you have correctly formulated the problem for the solver ? If you want to maximise a function (the sharpe ratio) $f$, it is equivalent to minimise $-f$. This kind of confusion (minimising instead of maximising) would basically lead to a similar outcome as yours.


1

For those experiencing a similar problem, here is the solution that worked for me: ## OPTIMIZE PORTFOLIO WEIGHTS UNDER THE OBJECTIVE OF MAXIMIZING THE SHARPE RATIO ## WHILE CONSTRAINING THE WEIGHTS TO SECTOR BOUNDS ## PAPER: # ACCORDING TO: http://people.stat.sc.edu/sshen/events/backtesting/reference/maximizing%20the%20sharpe%20ratio.pdf np.random.seed(101)...


1

This is very simply done. It involves ensuring the constraints are presented as part of the matrix standard form. You will typically have the constraint that all assets sum to one, i.e. the matrix-vector equation: $$ \delta^T x = 1 $$ If you want to create an inequality constraint for assets in a sector just isolate them: $$ \begin{bmatrix} 1 & 1 &...


8

You seem to have two distinct problems: How to generate random portfolios How optimal portfolios are structured Ad 1) A straightforward way to simulate the weights of random portfolios is to use the Dirichlet distribution $Dir(\alpha_1,\ldots,\alpha_n)$. This is a distribution on the Simplex (i.e. on $S=\{x\in\mathbb{R}^n | \sum x_i =1, x_i\geq 0\}$, ...


1

The problem is how to generate random weights subject to a constraint that the sum of the weights has to be equal to 1. The following pseudo-code illustrate one method: Let free_weight := 1 For i=1 to N Select an asset j **at random** among the assets not yet given a weight If i < N then Let w(j) := free_weight * rand1() /* rand1() ...


Top 50 recent answers are included