Practice with PyPortfolioOpt: returns
Modern Portfolio Theory is the cornerstone of portfolio risk management, because the efficient frontier is a standard method of assessing both investor risk appetite and market risk-return tradeoffs. In this exercise you'll develop powerful tools to explore a portfolio's efficient frontier, using the PyPortfolioOpt pypfopt Python library.
To compute the efficient frontier, both expected returns and the covariance matrix of the portfolio are required.
After some practice loading the investment bank price data, you'll use pypfopt.expected_returns's mean_historical_return method to compute and visualize the annualized average returns of each bank from daily asset prices. The following exercise will then cover the covariance matrix.
Deze oefening maakt deel uit van de cursus
Quantitative Risk Management in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Load the investment portfolio price data into the price variable.
prices = pd.____("portfolio.csv")
# Convert the 'Date' column to a datetime index
prices['Date'] = pd.to_datetime(____['Date'], format='%d/%m/%Y')
prices.____(['Date'], inplace = True)