You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,20 +256,24 @@ The covariance matrix encodes not just the volatility of an asset, but also how
256
256
- Long/short: by default all of the mean-variance optimization methods in PyPortfolioOpt are long-only, but they can be initialised to allow for short positions by changing the weight bounds:
257
257
258
258
```python
259
-
ef = EfficientFrontier(mu, S, weight_bounds=(-1, 1))
259
+
>>> ef = EfficientFrontier(mu, S, weight_bounds=(-1, 1))
260
+
260
261
```
261
262
262
263
- Market neutrality: for the `efficient_risk` and `efficient_return` methods, PyPortfolioOpt provides an option to form a market-neutral portfolio (i.e weights sum to zero). This is not possible for the max Sharpe portfolio and the min volatility portfolio because in those cases because they are not invariant with respect to leverage. Market neutrality requires negative weights:
263
264
264
265
```python
265
-
ef = EfficientFrontier(mu, S, weight_bounds=(-1, 1))
- Minimum/maximum position size: it may be the case that you want no security to form more than 10% of your portfolio. This is easy to encode:
270
273
271
274
```python
272
-
ef = EfficientFrontier(mu, S, weight_bounds=(0, 0.1))
275
+
>>> ef = EfficientFrontier(mu, S, weight_bounds=(0, 0.1))
276
+
273
277
```
274
278
275
279
One issue with mean-variance optimization is that it leads to many zero-weights. While these are
@@ -278,9 +282,12 @@ mean-variance portfolios to underperform out-of-sample. To that end, I have intr
278
282
objective function that can reduce the number of negligible weights for any of the objective functions. Essentially, it adds a penalty (parameterised by `gamma`) on small weights, with a term that looks just like L2 regularisation in machine learning. It may be necessary to try several `gamma` values to achieve the desired number of non-negligible weights. For the test portfolio of 20 securities, `gamma ~ 1` is sufficient
0 commit comments