November 2019
Beginner
394 pages
10h 31m
English
In this section, we will implement the double moving average strategy. We will use the same code pattern from the prior chapters to get the GOOG data:
import pandas as pd import numpy as np from pandas_datareader import data def load_financial_data(start_date, end_date,output_file): try: df = pd.read_pickle(output_file) print('File data found...reading GOOG data') except FileNotFoundError: print('File not found...downloading the GOOG data') df = data.DataReader('GOOG', 'yahoo', start_date, end_date) df.to_pickle(output_file) return df goog_data=load_financial_data(start_date= ...