We'll begin our strategy development by focusing on the technical aspects. Let's take a look at the S&P 500 over the last few years. We'll use pandas to import our data. This will give us access to several sources of stock data, including Yahoo! And Google.
- First, you'll need to install the data reader:
!pip install pandas_datareader
- Then, go ahead and incorporate your imports:
import pandas as pd from pandas_datareader import data, wb import matplotlib.pyplot as plt %matplotlib inline pd.set_option('display.max_colwidth', 200)
- Now, we'll get our data for the SPY ETF, which represents the stocks of the S&P 500. We'll pull data from the start of 2010 through December 2018:
import pandas_datareader as pdr start_date = pd.to_datetime('2010-01-01') stop_date = pd.to_datetime...