1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Portfolio Analysis in Python

Exercise

Changing the span

At the last exercise you discovered that the span of the exponentially weighted risk and return can have an impact on what the optimal portfolio looks like. In fact, the span has a very big influence! By setting the span, you can either use data for say only the most recent days, or use data from the most recent years. In the limit, when the span is as long as the full sample, it will be equal to using the normal historic mean.

Now let's get a feel for how a short and long span changes your optimal portfolio. Available is the stock_prices data.

Instructions 1/2

undefined XP
  • 1
    • Set a really long span of 2 years of trading days, assuming that one year has 252 days.
  • 2
    • Change the span to 10 days, and see how that changes your optimal portfolio.