Exercise

Industry exposures with Pyfolio

You saw in the first video of this chapter how to use a groupby function to create the active weights per industry. The drawback is that it takes a snapshot in time. Since portfolio weights change, you can imagine that the industry exposures change over time as well. However, the calculation to determine industry exposures on each day for your portfolio, can become quite tedious and complex.

Luckily, you can use Pyfolio's tear sheet for this. The tear sheet shows you exposures over time, and summarizes overall top stock picks in your portfolio. Available is data on your portfolio returns under returns, and your daily positions in dollar value per stock, under positions. Go ahead and inspect positions and returns in the console.

Instructions 1/3

undefined XP
    1
    2
    3
  • Inspect positions and returns in the console. Then, assign the Technology sector to the DELL stock in your sector mapping. Notice that the sector mapping assigns an industry to each stock in your portfolio.