ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Financial Trading in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Print the top five rows
print(____.____())
Editar y ejecutar código