Created
March 13, 2017 17:01
-
-
Save davetromp/df0aafd68b25f2d973cea4ff0271088f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
def getData(ticker): | |
url = "http://chart.finance.yahoo.com/table.csv?s={}&a=1&b=12&c=2017&d=2&e=12&f=2017&g=d&ignore=.csv".format(ticker) | |
data = urllib.request.urlopen(url) | |
doc = open("yahoo_finance_{}.csv".format(ticker), 'w') | |
doc.write(data.read().decode("utf8")) | |
doc.close() | |
tickers = ["AAPL", "IBM", "SAM"] | |
for ticker in tickers: | |
getData(ticker) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment