|
Testset=["NVDA",
"AMD",
"INTL",
"AAPL",
"MSFT",
"GOOG",
"SNE",
"MS",
"TSLA",
"AMZN",
"HPQ",
"AXP",
"NTES",
"FB",
"ADBE",
"NKE",
"TXN",
"QCOM",
"KO",
"CSCO"]
print(len(Testset))
import pandas as pd
import pandas_datareader.data as web
import datetime
def loadDatafromYahoo(stockName):
start = datetime.datetime(2014,1,1)
# end = datetime.date.today()
end = datetime.datetime(2019,5,3)
DataTemp = web.DataReader(stockName, "yahoo", start, end)
DataFile = pd.DataFrame(DataTemp)
DataFile.to_csv(stockName,index='Date',sep=',')
return DataTemp

import matplotlib.pyplot as plt # Import matplotlib
# This line is necessary for the plot to appear in a Jupyter notebook
%matplotlib inline
# Control the default size of figures in this Jupyter notebook
%pylab inline
pylab.rcParams['figure.figsize'] = (15, 9) # Change the size of plots
pylab.xlabel('Date')
pylab.ylabel('Dollars')
# pylab.title('Google')
dataToCSV["Adj Close"].plot(grid = True) # Plot the adjusted closing price of AAPL
dataToCSV2["Adj Close"].plot(grid = True)
dataToCSV3["Adj Close"].plot(grid = True)
# 注释
plt.legend(('Google', 'Apple','Microsoft', 'sharp interface'),
shadow=True, loc=(0.01, 0.68), handlelength=1.5, fontsize=16)
|