Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Measuring Risk of Portfolio | Portfolio Analysis Basics
Introduction to Portfolio Management with Python
course content

Course Content

Introduction to Portfolio Management with Python

Introduction to Portfolio Management with Python

1. Portfolio Analysis Basics
2. Portfolio Optimization Basics
3. Factor Investing

book
Measuring Risk of Portfolio

What is Risk?

Let's discover the second key concept in portfolio analysis - risk.

First of all, let's define what risk is.

Practically, investing always involves risk because asset prices fluctuate frequently. They can fall just as easily as they can rise.

Common Measure of Risk

The question arises: how to measure risk?

Since investing is considered riskier when an asset's price fluctuates more significantly, a common measure of risk is the standard deviation of an asset's return.

This is common measure, also known as volatility.

Below is a code example of computing risks, using stock shares of Apple, Meta, and Amazon as assets:

1234567891011121314151617181920
# Importing pandas library import pandas as pd # Creating DataFrame `stocks` with values of stock prices of Apple, Meta and Amazon # for the period from `2024-09-06` to `2024-09-11` stocks = pd.DataFrame(index = ['2024-09-06', '2024-09-09', '2024-09-10', '2024-09-11'], columns = ['Apple', 'Meta', 'Amazon'], data = [[220.14, 499.60, 170.56], [220.88, 505.90, 176.25], [219.74, 504.56, 179.40], [222.14, 512.20, 184.05]]) print('Stock data:') print(stocks) print('Returns:') print(stocks.pct_change()) print('Risks:') print(stocks.pct_change().std())
copy

Here, as well as in the previous chapter, we use the stocks.pct_change() construction to compute the returns of each asset. Additionally, we apply the std() method on the resulting DataFrame to compute the standard deviation of each asset's return.

Risk of Portfolio

After we have covered the key aspects of the risk associated with individual investments, it's time to turn our attention to the risk of an entire portfolio.

We will explore this topic in the following video:

Here is a corresponding Google Colab.

Additionally, there are several other measures of financial risk, some of which we will explore in later chapters of this course.

Why do we need consider covariance matrix of returns while computing risk of portfolio?

Why do we need consider covariance matrix of returns while computing risk of portfolio?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 5
We're sorry to hear that something went wrong. What happened?
some-alt