Exercise

Define and backtest a simple strategy

You want to create a strategy to trade the so-called "FAANG" stocks, which is an acronym referring to the stocks of the five most popular and best-performing American technology companies: Facebook, Amazon, Apple, Netflix, and Alphabet (a.k.a. Google).

The idea is simple, you will hold an equal amount of each stock in your portfolio. Every week the strategy will buy or sell shares as needed in order to balance the equal weights.

First, you will inspect the data for the "FAANG" stocks. Second, you will define the strategy, which specifies buying an equal amount of each stock, and rebalance every week. Lastly, you will run the backtest and plot the result.

The bt package has been imported for you. The historical price data of the "FAANG" has been preloaded in bt_data.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Inspect the top 5 rows of the stock data in bt_data.