When constructing a multi-asset portfolio, coming up with the strategy to allocate weights to the portfolio components is a very important step in the process. Coming up with weights for a portfolio given its components can be done in a number of ways and is a question that boggles even the most skilled managers. So what is the most optimal way to do this? in this article we will try to introduce the most widely used methods and understand the intuition behind them.

When we think naively about this, the most intuitive way of allocating to the securities would be based on our conviction for them. In the early days of the financial market’s history traders actually used to do that and be profitable. As the trend following strategies saw crashes in early 1997 with increased volatility in the markets, traders started adding stop losses and take profits and staggered entry and exit to the strategies.

After the Global Financial Crisis in 2008 “risk-parity” became a widely followed strategy. This strategy allocated equal risk budgets to allparticipating assets anddoes not look at investor views or expected return projections. The most popular method that does incorporate views is the Markovitz Mean-Variance Optimal portfolio based on the Capital Asset Pricing Model or CAPM. The passive portfolios like the market index use a market-cap-weighted allocation. Other naïve methodologies are the equal weight portfolio or the minimum variance portfolio.

The literature around portfolio optimization is rich and vast. There are a wide variety of variations and improvements upon the basic methods and a lot of active research that goes around it. I worked on a variation of risk parity called “risk budgeting” and a novel “active risk budgeting” when working on the US managed futures strategies. There is even a use case of machine learning methods like reinforcement learning methods that find a good fit for this problem.

In this post, we take an introductory glance at the rationale of some popular portfolio construction methods and their implementation in Python. We will also look at how each of these methods performs for an example portfolio consisting of sectoral indices published on the NSE namely, Bank, Auto, Fin Service, FMCG, IT, Media, Metal, Pharma, PSU Bank, Private Bank, Realty.

We rebalance our portfolios quarterly and trade in a long-only fashion.

## What is Portfolio Optimization?

Portfolio optimization is a financial strategy that aims to construct an investment portfolio in such a way that it maximizes returns or minimizes risks, or achieves a balance between the two, given certain constraints. This process involves selecting a combination of assets, such as stocks, bonds, real estate, or other investments, to create a portfolio that aligns with an investor's financial goals and risk tolerance.

The ultimate goal of portfolio optimization is to strike a balance between risk and return that aligns with the investor's financial situation and objectives. Different investors may have varying risk tolerances, time horizons, and return expectations, which will lead to different optimized portfolio strategies.

It's important to note that while portfolio optimization can be a powerful tool for investors, it is based on certain assumptions and historical data, and market conditions can change. Therefore, regular monitoring and potential adjustments to the portfolio are necessary to maintain its alignment with the investor's goals and changing market conditions.

## Importance of Portfolio Optimization

Portfolio optimization is of significant importance for several reasons:

### 1. Risk Management

Portfolio optimization helps investors manage and mitigate risk. By diversifying investments across different asset classes, industries, and securities, it reduces the impact of poor performance in any single investment on the overall portfolio. This diversification can help protect against significant losses during market downturns.

### 2. Return Maximization

Portfolio optimization seeks to maximize returns for a given level of risk or minimize risk for a given level of return. This ensures that investors are getting the most out of their investments while staying within their risk tolerance.

### 3. Alignment with Goals

It allows investors to tailor their portfolios to align with their financial goals, whether those goals are long-term wealth accumulation, retirement planning, income generation, or capital preservation. This customization is crucial for achieving specific financial objectives.

### 4. Efficiency

Optimized portfolios are designed to be efficient in terms of risk and return. They aim to strike the right balance between these two factors, which is essential for achieving financial success while avoiding unnecessary risk.

### 5. Continuous Improvement

Portfolio optimization is not a one-time process. It involves ongoing monitoring and adjustment to adapt to changing market conditions, economic trends, and an investor's changing financial situation or objectives. This adaptability ensures that the portfolio remains effective over time.

### 6. Scientific Approach

It brings a scientific and systematic approach to investing. Instead of making investment decisions based solely on intuition or emotion, portfolio optimization relies on data, mathematical models, and statistical analysis to make informed choices.

### 7. Mitigating Behavioral Biases

Investors often make decisions influenced by emotions or behavioral biases, such as overconfidence or fear. Portfolio optimization provides a disciplined framework that can help investors avoid making impulsive or irrational investment choices.

### 8. Transparency

It offers transparency in the decision-making process. Investors can clearly understand how and why assets are selected, allocated, and adjusted in their portfolios, which builds trust and confidence in their investment strategy.

### 9. Tax Efficiency

Portfolio optimization can also consider tax implications, helping investors minimize tax liabilities through strategies like tax-loss harvesting and tax-efficient asset placement.

### 10. Adaptability to Changing Goals

As an investor's financial goals change over time (e.g., from wealth accumulation to income generation in retirement), portfolio optimization can be adjusted to reflect these changing objectives.

In summary, portfolio optimization is crucial for investors who want to achieve their financial objectives while managing risk effectively. By using data-driven methods and a systematic approach, it helps investors make informed investment decisions, maximize returns, and maintain alignment with their ever-evolving financial goals.

## Portfolio Optimization Techniques and Formulas

Portfolio optimization techniques and formulas are used to determine the optimal allocation of assets within a portfolio to achieve specific investment objectives. Here are some commonly used techniques and formulas:

**Mean-Variance Optimization (MVO):**MVO, pioneered by Harry Markowitz, is a popular portfolio optimization technique. It aims to find the allocation of assets that maximizes expected return for a given level of risk (measured by variance or standard deviation). The formula involves calculating the expected returns, covariance matrix, and risk tolerance of assets to derive the optimal portfolio weights.

**Capital Asset Pricing Model (CAPM):**CAPM is a model that helps determine the expected return of an asset based on its systematic risk (beta) and the risk-free rate. In portfolio optimization, CAPM can be used to calculate the expected returns of assets and incorporate them into the optimization process.

**Black-Litterman Model:**The Black-Litterman model combines investor views or opinions with market equilibrium assumptions to derive an optimal portfolio allocation. It uses a formula that incorporates the market weights, covariance matrix, and the investor's views to determine the portfolio weights.

**Risk Parity:**Risk parity is a portfolio allocation strategy that aims to distribute risk equally across different assets or asset classes. The formula involves assigning portfolio weights based on the inverse of the asset's volatility or other risk measures.

**Kelly Criterion:**The Kelly Criterion is a formula used to determine the optimal allocation of capital in situations with known probabilities of outcomes. It helps calculate the optimal bet size based on the expected return and risk of an investment.

**Sharpe Ratio:**The Sharpe Ratio measures the risk-adjusted performance of an investment or portfolio. It is calculated by dividing the excess return (return above the risk-free rate) by the standard deviation of returns. The higher the Sharpe Ratio, the better the risk-adjusted performance.

**Efficient Frontier:**The efficient frontier is a graphical representation of all possible portfolios that provide the maximum return for a given level of risk or the minimum risk for a given level of return. It helps investors visualize the optimal allocation of assets in a portfolio.

These techniques and formulas serve as valuable tools for portfolio managers and investors to optimize their asset allocation decisions based on their risk appetite, return expectations, and investment constraints. It's important to note that these techniques involve assumptions and limitations, and careful consideration of individual circumstances is necessary for effective portfolio optimization.

## Equal Weight

This method assigns equal weights to all components. This would be most useful when the returns across all interested assets are purely random and we have no views.

def equal_weighted_portfolio(w, V):''' The equal weighted portfolio returns equal weights to each of the portfolio components'''return [1.0/len(w)]*len(w)

We’ll see the returns of an equal-weighted portfolio comprising of the sectoral indices below.

The annualized return is 13.3% and the annualized risk is 21.7%

## What is a Risk Parity Portfolio?

Risk parity represents a sophisticated portfolio approach frequently employed by hedge funds and seasoned investors. It relies on intricate quantitative methodologies, setting it apart from simpler allocation strategies by offering more advanced allocation techniques. The primary objective of risk parity investing is to attain the optimal level of return commensurate with a specified risk threshold.

Traditional allocation methods, exemplified by the 60%/40% stocks-bonds portfolio, rely on Modern Portfolio Theory (MPT). MPT establishes a conventional framework for diversification within an investment portfolio, aiming to maximize expected returns while maintaining a predetermined risk level. In these simplified MPT strategies, when comprising only stocks and bonds, equity allocations typically lean towards a heavier weighting for investors seeking higher risk exposure. Conversely, risk-averse investors opt for a greater allocation to bonds to preserve capital.

In contrast, risk parity strategies offer a broader toolkit, incorporating leverage, alternative diversification, and even short selling in portfolios and funds. Under this approach, portfolio managers have the flexibility to select any combination of assets. Yet, rather than deriving allocations to various asset classes to achieve an ideal risk target, risk parity strategies center their investments on the optimal risk threshold level. This objective is frequently attained by employing leverage to evenly distribute risk across diverse asset classes in accordance with the specified risk threshold.

## Risk Parity Portfolio Optimization

The risk contribution of each asset is equal. This method gained popularity after the 2008 crisis. Risk parity works best in a world where the Sharpe ratios between all asset classes are the same (and consequently equal risk contribution would contribute equal returns).

**The weights are a solution to the optimization equation -**

Where, w is the weight, ∑ is the covariance matrix and n is the number of assets

def risk_parity(w, V): def calculate_portfolio_variance(w,V):# function that calculates portfolio riskw = np.matrix(w) return (w*V*w.T)[0,0] def calculate_risk_contribution(w,V):# function that calculates asset contribution to total riskw = np.matrix(w) sigma = np.sqrt(calculate_portfolio_variance(w,V))# Marginal Risk ContributionMRC = V*w.T# Risk ContributionRC = np.multiply(MRC,w.T)/sigma return RC def risk_budget_objective(x,pars):# calculate portfolio riskV = pars[0]# covariance tablex_t = pars[1]# risk target in percent of portfolio risksig_p = np.sqrt(calculate_portfolio_variance(x,V))# portfolio sigmarisk_target = np.asmatrix(np.multiply(sig_p,x_t)) asset_RC = calculate_risk_contribution(x,V) J = sum(np.square(asset_RC-risk_target.T))[0,0]# sum of squared errorreturn J def total_weight_constraint(x): return np.sum(x)-1.0 w0 = x_t = [1.0/len(w)]*len(w) cons = ({'type': 'eq', 'fun': total_weight_constraint}) res= minimize(risk_budget_objective, w0, args=[V,x_t], method='SLSQP',constraints=cons, options={'disp': True}) return np.asmatrix(res.x)

The annualized return is 13.40% and the annualized risk is 24.7%. We can see that low volatility sector like FMCG get higher weight and high-risk sectors like PSU Bank get lower weight.

## Minimum Variance

This method minimizes the portfolio’s volatility. This would work best when the returns are not proportional to risk and lowering risk does not lead to lower returns as well.

**The weights are a solution to the equation,**

Where, w is the weight, ∑ is the covariance matrix

def minimum_variance(w0, V): def calculate_portfolio_var(w, pars):# function that calculates portfolio riskV = pars# covariance tablew = np.matrix(w) return (w * V * w.T)[0, 0] def total_weight_constraint(x): return np.sum(x) - 1.0 cons = ({'type': 'eq', 'fun': total_weight_constraint}) res = minimize(calculate_portfolio_var, w0, args=V, method='SLSQP', constraints=cons, options={ 'disp': False}) return np.asmatrix(res.x)

The annualized return is 13.6% and the annualized risk is 20.8%. This looks quite similar to the equal weight example and could be because the risks of the indices are similar and the optimizer based solution to low-risk portfolio stops at a local minimum.

## Mean-Variance Optimization

This is the famous Markovitz Portfolio. This is a mathematical framework for assembling a portfolio of assets such that the expected return is maximized for a given level of risk.

The weights are a solution to the optimization problem for different levels of expected returns,

Where, w is the weight, ∑ is the covariance matrix and N is the number of assets, R is the expected return and q is a “risk tolerance” factor, where 0 results in the portfolio with minimal risk and ∞ results in the portfolio infinitely far out on the frontier with both expected return and risk unbounded.

def mean_variance_optimization(w, V): def calculate_portfolio_risk(w, V):# function that calculates portfolio riskw = np.matrix(w) return np.sqrt((w * V * w.T)[0, 0]) def calculate_portfolio_return(w, r):# function that calculates portfolio returnreturn np.sum(w*r) def optimize(w, V, target_return=0.1): init_guess = np.ones(len(symbols)) * (1.0 / len(symbols)) weights = minimize(get_portfolio_risk, init_guess, args=(normalized_prices,), method='SLSQP', options={'disp': False}, constraints=({'type': 'eq', 'fun': lambda inputs: 1.0 - np.sum(inputs)}, {'type': 'eq', 'args': (normalized_prices,), 'fun': lambda inputs, normalized_prices: target_return - get_portfolio_return(weights=inputs, normalized_prices=normalized_prices)})) return weights.x optimal_risk_all = np.array([]) optimal_return_all = np.array([]) for target_return in np.arange(0.005, .0402, .0005): opt_w = optimize(prices=prices, symbols=symbols, target_return=target_return) optimal_risk_all = np.append(optimal_risk_all, get_portfolio_risk(opt_w, V)) optimal_return_all = np.append(optimal_return_all, get_portfolio_return(opt_w, w)) return optimal_return_all, optimal_risk_all

The annualized return is 15.2% and the annualized risk is 21.9%. We have taken the portfolio with the highest level of risk, one could actually choose a risk-based on her risk tolerance.

On an overall level, we see that mean-variance optimization is possibly the best method for our example.

Now surely each of these methods could be of choice under different conditions contingent on different factors. So what are the factors to look at?

## Factors Affecting Portfolio Optimization

## Behavioural Factors

The investor’s risk outlook or risk aversion is obviously the most important factor to keep in mind while deciding the portfolio construction method. The choice of instruments and the investment horizon guide the diversification available and the methodology so this is the most important factor.

## Correlation

Correlation guides diversification. In their research posted recently Resolve Asset Management demonstrate that the optimization-based methods outperform naive methods only when there is an opportunity to diversify and a large number of risk factors present. For imperfectly correlated assets the portfolio returns and volatility are different from the weighted sum. So correlation plays a big role in the choice of the portfolio construction method.

## Market Regime

We showed that minimum variance is optimal when all return assumptions are same and risk parity is optimal when all risk-adjusted returns are the same. Such scenarios actually occur as the markets change regimes. There are actual regimes where returns are inversely correlated to risk while others where higher risk is rewarded by higher returns. This makes market regimes a good factor to look at when evaluating the portfolio construction methods.

## Challenges in Portfolio Optimization

Portfolio optimization is a powerful tool in finance, but it's not without its challenges. Here are some of the key challenges associated with portfolio optimization:

**Uncertainty in Market Data:**Portfolio optimization relies on historical data for return expectations, volatility, and correlations among assets. However, market conditions can change, and past data may not accurately reflect future behavior. This uncertainty can lead to suboptimal results.

**Model Assumptions:**Portfolio optimization often relies on mathematical models and assumptions about asset returns and risks. These assumptions may not hold in all market conditions, potentially leading to portfolio underperformance.

**Overfitting:**Trying to fit a model too closely to past data can lead to overfitting. This means the model may work well historically but poorly in the future because it has essentially memorized past patterns rather than capturing genuine relationships.

**Transaction Costs:**Real-world investing involves transaction costs such as brokerage fees, bid-ask spreads, and taxes. These costs can significantly impact the performance of an optimized portfolio and make it challenging to implement the theoretical portfolio in practice.

**Illiquidity:**Some assets may be illiquid, making it difficult to trade them in large quantities without impacting their prices. This illiquidity can limit the ability to implement certain portfolio allocations.

**Limited Asset Universe:**Portfolio optimization assumes that investors have access to a wide range of assets. In reality, investors may have restrictions on the types of assets they can hold, limiting their ability to fully diversify.

**Regulatory and Tax Constraints:**Investors often face regulatory constraints and tax considerations that can impact portfolio construction. For example, tax implications may favor one investment over another, even if the latter is theoretically more optimal.

**Behavioral Biases:**Investors may have behavioral biases that lead them to deviate from the optimal portfolio. They may buy or sell assets based on emotions or short-term market movements rather than sticking to a long-term optimized strategy.

**Changing Risk Tolerance:**An investor's risk tolerance may change over time due to changing financial circumstances, life events, or market experiences. Maintaining alignment between the portfolio and the investor's risk preferences is an ongoing challenge.

**Black Swan Events:**Extreme and unexpected events, often referred to as "black swan" events, can have a profound impact on portfolios. These events are, by their nature, difficult to predict and plan for in portfolio optimization.

**Lack of Stationarity:**The assumption that asset returns and correlations remain stationary over time is often challenged. In reality, market conditions, economic factors, and asset behavior can evolve, making it hard to rely on historical data.

**Model Complexity:**As portfolios become more complex, with numerous assets and constraints, the optimization problem itself can become computationally intensive. Solving these complex problems can be challenging, especially in real-time.

## Best Practices and Tips for Portfolio Optimization

Portfolio optimization is the process of choosing the best portfolio out of the set of all portfolios available, based on investors' risk-return preferences. The best practices and tips for portfolio optimization include proper diversification, strategic asset allocation, and regular rebalancing.

### Diversification

Diversification, investing in a variety of assets, is crucial to manage risk and reduce the potential for large losses. It involves spreading investments across various asset classes such as equities, bonds, commodities, and alternative investments, to ensure that the poor performance of one investment doesn't significantly impact the entire portfolio.

### Strategic asset allocation

Strategic asset allocation involves setting target allocations for various asset classes, and periodically rebalancing the portfolio back to these targets as investment returns shift the portfolio away from the initially planned asset allocation.

### Rebalancing

Rebalancing helps maintain the desired level of risk and can lead to higher long-term returns. Furthermore, incorporating the use of advanced tools and platforms that utilize algorithms and machine learning can help optimize the portfolio even further.

Finally, understanding one's risk tolerance, investment horizon, and financial goals are crucial to designing and optimizing a portfolio effectively.

## Benefits of Optimizing Investment Portfolios with Wright Research

Wright Research offers unique benefits for optimizing investment portfolios. With a focus on data-driven research, Wright Research provides robust tools and strategies to assist investors in making informed decisions, optimizing portfolios, and improving overall investment performance. The use of cutting-edge technology in the form of artificial intelligence and machine learning enables Wright Research to analyze vast amounts of data and generate insights that would be impossible to garner manually.

By using Wright Research, investors can take advantage of professionally curated strategies that align with various risk profiles and investment objectives. Wright Research's strategies are known for their efficiency and effectiveness in capturing market opportunities and mitigating potential risks, providing investors with the optimal blend of investments for their specific needs. Furthermore, Wright Research's manual mode offers a great deal of flexibility, enabling investors to invest in stocks directly without using a predetermined interface. This helps investors customize their portfolio to better match their personal investment goals and risk tolerance.

## Conclusion

I hope this article gives the reader a good start in the exploration of the wonderful field of research on portfolio construction and optimization. This interesting area of research can add levels of sophistication to any systematic trading strategy.

## FAQs

**How does risk parity portfolio optimization work, and what are its benefits?**

Risk parity portfolio optimization aims to allocate assets in a way that distributes risk equally among different asset classes or securities. By assigning weights based on risk measures like volatility or other risk metrics, it seeks to balance the contribution of each asset to overall portfolio risk. Benefits include potential for improved diversification, reduced concentration risk, and the ability to potentially achieve more consistent risk-adjusted returns.

**Can you provide examples of portfolio optimization techniques and formulas?**

Some common portfolio optimization techniques include the Mean-Variance Optimization, which uses Harry Markowitz's Modern Portfolio Theory, and the Sharpe Ratio Optimization. Mean-Variance Optimization maximizes expected return for a given level of risk by solving a quadratic optimization problem. The formula involves expected returns, variances, and covariances of the different assets in the portfolio.

On the other hand, Sharpe Ratio Optimization aims to maximize the portfolio's Sharpe Ratio, which is the average return earned in excess of the risk-free rate per unit of volatility. The formula for Sharpe Ratio is (Portfolio Return - Risk-free Rate)/Portfolio Standard Deviation.

**How can portfolio optimization contribute to diversification and asset allocation strategies?**

Portfolio optimization allows for strategic allocation of assets, taking into account risk and return objectives. By optimizing asset allocation, investors can achieve diversification by spreading investments across different asset classes, sectors, or regions. This helps to mitigate risk and potentially enhance overall portfolio performance.

**What factors should be considered when monitoring and rebalancing an optimized portfolio?**

Factors to consider when monitoring and rebalancing an optimized portfolio include changes in market conditions, asset class performance, risk tolerance, target asset allocations, and investment objectives. Regular review and rebalancing are necessary to ensure the portfolio remains aligned with the desired risk and return profiles.

**Can risk parity portfolio optimization help reduce portfolio volatility and enhance risk-adjusted returns?**

Yes, Risk Parity Portfolio Optimization can help reduce portfolio volatility and enhance risk-adjusted returns. The strategy focuses on allocating risk equally among different asset classes rather than allocating capital. This approach diversifies the sources of risk in the portfolio, helping to reduce overall volatility. It also aims to enhance risk-adjusted returns as it often involves investing in asset classes with higher risk and potentially higher returns.

**Are there any specific challenges or considerations when implementing risk parity portfolio optimization?**

Challenges when implementing risk parity portfolio optimization include the selection and accuracy of risk measures, the stability of correlations among assets, the availability of historical risk data, and the potential impact of leverage. It's important to consider these factors and conduct robust analysis to ensure effective implementation.

**What performance metrics are commonly used to evaluate the effectiveness of risk parity portfolios?**

Common performance metrics for evaluating effectiveness of risk parity portfolios include the Sharpe Ratio, which measures risk-adjusted return, and the Sortino Ratio, which adjusts for downside risk. Additionally, the Standard Deviation or Volatility of the portfolio return is often used to measure risk, while the Maximum Drawdown, the maximum loss from a peak to a trough of a portfolio, is used to evaluate the potential for losses.