1. Learn
  2. /
  3. Courses
  4. /
  5. Quantitative Risk Management in Python

Connected

Exercise

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.

Instructions 1/2

undefined XP
    1
    2
  • Load portfolio data portfolio.csv into prices using the .read_csv() method.
  • Convert the 'Date' column in prices to the datetime format, and make it the index using prices's .set_index() method.