Session Ready
Exercise

Perform a strategy benchmarking

You are wondering: instead of spending energy actively trading a stock, what if you just sit back and hold the stock for a period of time. Does your active trading strategy generate better profits than a passive buy-and-hold strategy? To answer this question, you plan to perform a benchmarking test.

The bt package has been imported for you. In addition, the three strategy backtests sma10, sma30. sma50 from the previous exercise have been pre-loaded, and can be used directly.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Complete the function buy_and_hold that takes ticker as one of the variables. Use ticker to get the stock price_data.
  • Define a passive buy and hold strategy, and return a bt backtest.