ÎncepețiÎncepe gratuit

Calculating expected risk and returns

For this exercise, you're going to start with the raw price data. What you'll need for portfolio optimization, is the expected risk and return from this data.

With PyPortfolioOpt, you can calculate the expected risk and return in just one line of code, so that makes it very easy for you. The library you need is called pypfopt in short. FYI, you'll see in the next exercise that PyPortfolioOpt gives you the same output if you were to calculate it by hand. Let's give it a try!

Acest exercițiu face parte din cursul

Introduction to Portfolio Analysis in Python

Vezi cursul

Exercițiu interactiv practic

Încearcă acest exercițiu completând acest cod de exemplu.

# Import the packages 
from ____ import risk_models
from ____ import expected_returns
from pypfopt.efficient_frontier import ____
Editează și rulează codul