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
.
Cet exercice fait partie du cours
Financial Trading in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Print the top five rows
print(____.____())