Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Portfolio Diversification | Risk Analysis and Portfolio Management
Python for FinTech

bookPortfolio Diversification

Diversification is a core principle in portfolio management that aims to reduce risk by spreading investments across different assets. The idea is that by holding a variety of assets, you decrease the impact that any single asset's poor performance can have on the overall portfolio. This is because not all assets move in the same direction or with the same magnitude at the same time.

Correlation is a statistical measure that describes how two assets move in relation to each other. It ranges from -1 to 1:

  • A correlation of 1 means both assets move perfectly in sync;
  • A correlation of 0 means their movements are unrelated;
  • A correlation of -1 means the assets move in exactly opposite directions.

Understanding how assets are correlated is crucial for portfolio construction. When you combine assets with low or negative correlation, you can achieve a smoother, more stable overall portfolio performance, reducing risk without necessarily sacrificing returns.

1234567891011
import numpy as np # Sample returns for two different assets asset_a_returns = [0.01, 0.02, -0.005, 0.03, 0.015] asset_b_returns = [-0.002, 0.018, 0.01, -0.004, 0.02] # Calculate correlation using numpy correlation_matrix = np.corrcoef(asset_a_returns, asset_b_returns) correlation = correlation_matrix[0, 1] print("Correlation between Asset A and Asset B:", round(correlation, 2))
copy

When assets in a portfolio have negative or low correlation, the ups and downs of their returns tend to offset each other. This means that when one asset's value drops, the other might remain stable or even increase, helping to cushion the overall impact on your portfolio. As a result, the total volatility—or risk—of the portfolio can be lower than that of the individual assets. This is the main reason diversification works: combining assets that do not move together reduces the likelihood of experiencing large losses at the same time.

123456789101112131415161718192021
import numpy as np # Assume equal investment in both assets weights = np.array([0.5, 0.5]) returns = np.array([asset_a_returns, asset_b_returns]) # Calculate average returns for each asset mean_returns = np.mean(returns, axis=1) # Portfolio expected return portfolio_return = np.dot(weights, mean_returns) # Calculate covariance matrix cov_matrix = np.cov(returns) # Portfolio variance portfolio_variance = np.dot(weights.T, np.dot(cov_matrix, weights)) # Portfolio standard deviation (risk) portfolio_risk = np.sqrt(portfolio_variance) print("Portfolio Expected Return:", round(portfolio_return, 4)) print("Portfolio Risk (Std Dev):", round(portfolio_risk, 4))
copy

1. What is the main benefit of diversification in a portfolio?

2. How does correlation between assets affect portfolio risk?

3. What does a correlation coefficient of -1 mean?

question mark

What is the main benefit of diversification in a portfolio?

Select the correct answer

question mark

How does correlation between assets affect portfolio risk?

Select the correct answer

question mark

What does a correlation coefficient of -1 mean?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 2

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

bookPortfolio Diversification

Veeg om het menu te tonen

Diversification is a core principle in portfolio management that aims to reduce risk by spreading investments across different assets. The idea is that by holding a variety of assets, you decrease the impact that any single asset's poor performance can have on the overall portfolio. This is because not all assets move in the same direction or with the same magnitude at the same time.

Correlation is a statistical measure that describes how two assets move in relation to each other. It ranges from -1 to 1:

  • A correlation of 1 means both assets move perfectly in sync;
  • A correlation of 0 means their movements are unrelated;
  • A correlation of -1 means the assets move in exactly opposite directions.

Understanding how assets are correlated is crucial for portfolio construction. When you combine assets with low or negative correlation, you can achieve a smoother, more stable overall portfolio performance, reducing risk without necessarily sacrificing returns.

1234567891011
import numpy as np # Sample returns for two different assets asset_a_returns = [0.01, 0.02, -0.005, 0.03, 0.015] asset_b_returns = [-0.002, 0.018, 0.01, -0.004, 0.02] # Calculate correlation using numpy correlation_matrix = np.corrcoef(asset_a_returns, asset_b_returns) correlation = correlation_matrix[0, 1] print("Correlation between Asset A and Asset B:", round(correlation, 2))
copy

When assets in a portfolio have negative or low correlation, the ups and downs of their returns tend to offset each other. This means that when one asset's value drops, the other might remain stable or even increase, helping to cushion the overall impact on your portfolio. As a result, the total volatility—or risk—of the portfolio can be lower than that of the individual assets. This is the main reason diversification works: combining assets that do not move together reduces the likelihood of experiencing large losses at the same time.

123456789101112131415161718192021
import numpy as np # Assume equal investment in both assets weights = np.array([0.5, 0.5]) returns = np.array([asset_a_returns, asset_b_returns]) # Calculate average returns for each asset mean_returns = np.mean(returns, axis=1) # Portfolio expected return portfolio_return = np.dot(weights, mean_returns) # Calculate covariance matrix cov_matrix = np.cov(returns) # Portfolio variance portfolio_variance = np.dot(weights.T, np.dot(cov_matrix, weights)) # Portfolio standard deviation (risk) portfolio_risk = np.sqrt(portfolio_variance) print("Portfolio Expected Return:", round(portfolio_return, 4)) print("Portfolio Risk (Std Dev):", round(portfolio_risk, 4))
copy

1. What is the main benefit of diversification in a portfolio?

2. How does correlation between assets affect portfolio risk?

3. What does a correlation coefficient of -1 mean?

question mark

What is the main benefit of diversification in a portfolio?

Select the correct answer

question mark

How does correlation between assets affect portfolio risk?

Select the correct answer

question mark

What does a correlation coefficient of -1 mean?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 2
some-alt