Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
17

Sorry for not being able to give more than one hyperlink, please do some web search for the project pages. Portfolio optimization could be done in python using the cvxopt package which covers convex optimization. This includes quadratic programming as a special case for the risk-return optimization. In this sense, the following example could be of some use:...


15

One simple method, based on the principles of mean-variance optimization, is to set the weights proportional to the product of the inverse of the covariance matrix and a vector of standard deviations. This implicitly assumes that the normalized expected return of each stock is equal. If you wish, you can take only the top 5 weights and set the others to zero....


14

You have the correct approach. (1) The simulation generates sampled portfolio values, $P_1,P_2, \dots, P_n$ at time $t=T$. VaR is specified as a left-tail percentile. Order the sample as $$P_{(1)} \leq P_{(2)} \leq \dots \leq P_{(n)}.$$ If you are considering $VaR_\alpha$ at the $100(1-\alpha) \% $ confidence level , then choose the smallest integer $k$ ...


9

The problem of the selecting the best portfolio (according to some risk measure) with a limited number of assets can be formulated as a mixed integer linear or quadratic program and is reviewed in the recent paper "Portfolio selection problems in practice: a comparison between linear and quadratic optimization models". It can be solved for reasonable sizes ...


8

Portfolio optimalisation depends heavily on the estimation of the moments (and therefore has HUGE estimation uncertainty). Even though it's useful for comparing and analysing different existing strategies, I think practitioners are moving more towards the usage of factor portfolios for the strategies themselves (e.g. Fama-French). Also because the ...


7

We actually managed to come up with the answer to this question ourselves but wanted to share the answer since it might be relevant to others as well. The calculation depends on what method is used to calculate the cost. There is the FIFO, LIFO and the average cost method, see: http://www.accounting-basics-for-students.com/fifo-method.html If FIFO or LIFO ...


6

Specifically, we have a generic conditional claim, $C$, that is a function of the diffusion process for the underlying, $S(t)$, and time $t$ so $C = C(S(t), t)$. As you pointed out, $C$ is an Ito process becuase it is a function of a stochastic process so we use Ito's Lemma to determine how the contingent claim varies as a function of the diffusion process $...


6

In recent years there has been much attention given to defining indexes other than market-cap based indices. While market-cap based indices approximate the theoretical Market Portfolio enshrined in textbooks, some people believe we could do better than that. One popular idea is that "market indexes overweight the most overvalued stocks", though this is ...


6

You can generalize the formula from a portfolio composed of 2 assets to a portfolio composed of $N$ assets as follows : $$ \sigma^2_{port} = \sum_{i=1}^N \sum_{j=1}^N \omega_i \text{cov} (i,j)\omega_j = \sum_{i=1}^N \sum_{j=1}^N \omega_i \sigma_{i,j}\omega_j $$ where $\sigma_{port}$ represents the standard deviation of your portfolio. Taking $N = 2$ ...


6

Different portfolio risk decompositions answer different questions. Before discussing what method to use, first ask why you want a decomposition and what definition of risk are you using. Is the point to examine how portfolio return volatility is affected by a tiny change in portfolio weights? On the other hand, if the point is to make a statement like, "30%...


5

It doesn't make sense to use option price series data for computing option risk anyway. Since they are derivatives (i.e. their value is derived from other securities) it is more basic and reasonable to handle the underlying risks. As hinted by John, the risks to an option portfolio are generally considered in the context of inputs to a pricing model (which ...


5

You can use empirical distribution and use Mean-CVaR as a target function. CVar ("Expected shortfall") is considered a better risk metrics than VaR if we depart from the light-tailed normal distribution. The code below is in R and is taken from the book "Portfolio Optimization with R/Rmetrics" By Diethelm Wuertz, Yohan Chalabi, William Chen, Andrew Ellis. ...


5

Of course estimating expected returns is the very core of portfolio management. Finding a useful covariance matrix too. To find both fills a book. So I first thought about closing the question. But it is a chance to discuss today's approaches. A nice approach that is very up-to-date where mementum investing seems very fashionable is the following: Momentum ...


5

Mean-variance (MV) is a framework rather than a prescription. This framework allows one to make, discuss, and defend his investment decision. In practice, there are many ways to make adjustments to this framework, if you believe they will improve performance. E.g. you can adjust the framework by stating "I will MV-optimize weights subject to "0" if the ...


5

The first step is to divide a very large number of stocks into deciles (groups having 10% of the stocks) based on some ranked measure (for example book to market or liquidity etc.), then you construct a spread of the highest decile vs the lowest decile returns by subtracting average D1 returns from average D10 returns. The idea is simply to understand how ...


5

We have weights $w_A$, $w_B$ and $w_C = 1 - w_A - w_B$ that sum to $1$. With de-meaned returns $r_A$, $r_B$, and $r_C$, the portfolio variance is $$E\{[w_A r_A + w_B r_B + (1 - w_A - w_B)r_C]^2 \} = w_A^2\sigma_A^2 + w_B^2\sigma_B^2 + 2 w_A w_B\rho_{AB}\sigma_A \sigma_B,$$ assuming the cash volatility $\sigma_C$ is zero.


5

This is a common problem in covariance matrix estimation, with several possible solutions. One of the simplest involves two steps: (1) You compute each element of the covariance matrix on a 'best efforts' basis, meaning you take the covariance of the two time series involved after REMOVING any data pairs having a N/A value. (Note that this means each ...


5

It's called 'Gross return' (a.k.a. 'Gross Rate of Return'). See Zivot Course Notes Eqn. 1.8 Also, as pointed by Alex C: ... in Statistics it is called a 'link relative' or 'chain relative' (because it links together (via multiplication) adjacent terms of the CPI index or other time series)


4

I reproduced Ledoit and Wolf's experiment outlined in their paper "Honey I Shrunk the Covariance Matrix" in Python which includes an implementation of their method to shrink the covariance matrix (can be found here see the get_shrunk_covariance_matrix() method on line 417). All the code for the entire thing is on Github here. I make use of the cvxopt module ...


4

The question is somewhat vague (lacking a well-defined objective), so this advice may not apply. Be mindful that you may be simultaneously considering multiple futures contracts that contain overlapping underlying constituents (e.g. futures that track the EuroStoxx 600 and DAX). If you are using a risk model, the idiosyncratic risk may not, in fact, be ...


4

7 years ago I had to solve the problem of a efficiency frontier under linear constraints on the asset weights and also stumbled upon Markowitz Critial Line Algorithm. I still have a directory with some resources in it. Since Bryce already gave a practical implementation with R code by Eric Zivot, I will concentrate on some papers which might help. I ...


4

If you only need to pick 5 out of 10 and want equal weights then just enumerate all 252 possibilities (as pointed out above) and compute the portfolio volatility $(\textbf{1}'K^{(i)}\textbf{1})^{1/2} = \left( \sum_{ij}K^{(i)}_{ij} \right)^{1/2}$, where $K^{(i)}$ is the covariance matrix for the $i$th subset. Then use whatever subset gives the lowest ...


4

The Portfolio Analytics package of R is an excellent package that can perform non-parametric portfolio optimization: https://r-forge.r-project.org/R/?group_id=579


4

I did not look at the data, but recall that beta is a parameter in the following equation: $$ r_A = \alpha + \beta r_B + \epsilon $$ relating two returns (random variables, samples) $r_A$ and $r_B$. To calculate beta you peform $$ \beta = \frac{cov(r_A,r_B)}{var(r_B)}. $$ Thus if assets $A$ and $B$ exchange roles, then only the denominator changes. In your ...


4

If $\Sigma$ is the covariance matrix of all assets and $w$ is the column vector of weightings of the asset in a certain portfolio. Then $$ w^T \Sigma w = VAR $$ is the variance of the portfolio. The contribution to volatility of asset $i$ is given by $$ w_i (\Sigma w)_i/\sqrt{VAR}, $$ where $(\Sigma w)_i$ is the $i_{th}$ entry in the vector $\Sigma w$. Note ...


4

Actually, neither of your two results are quite correct. As explained in the Details for the Return.calculate function, most of the PerformanceAnalytics functions use discrete returns, not log returns. To get the correct results, you will have to convert your data from log returns to simple returns. Compare the charts from the following: charts....


4

Non overlapping periods would make for a far smaller sample


4

Theoretically speaking (as it's done in financial textbooks at b-school level), variance and covariance are calculated on historical performance of asset classes, forward looking returns are CAPM calculated returns. ARIMA. Practically speaking, ARIMA is useless for predicting long term returns (or portfolio management if you wish). Why? A short answer is ...


4

The first portfolio $\Pi^{(1)}_t$ is a self-financing hedging portfolio. It is typically what you get when you delta hedge an option position (here short hence the minus sign, but it could be long without loss of generality) with shares of the underlying asset. If the only source of risk comes from the randomness of the underlying asset price $S_t$, then one ...


Only top voted, non community-wiki answers of a minimum length are eligible