LoslegenKostenlos loslegen

Portfolio variance

Your turn! It's time to calculate the risk of our 4-stock portfolio. Let's start with the pricing data, available under data. You'll have to calculate daily percentage returns and assign weights to your portfolio. You'll then continue by calculating the covariance matrix, and use the following formula: Portfolio variance = Weights transposed x (Covariance matrix x Weights) to get the final portfolio variance.

As calculating portfolio variance is an important part of portfolio analysis, make sure you take your time to understand each step, and go back to the slides if you need to. Good luck!

Diese Übung ist Teil des Kurses

Introduction to Portfolio Analysis in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Get percentage daily returns
daily_returns = data.____()

# Assign portfolio weights
weights = ____.____([____,____,____,____])
Code bearbeiten und ausführen