Created
August 24, 2017 17:56
-
-
Save notyal/e6fb3261018a148b7d958dd10122f39e to your computer and use it in GitHub Desktop.
Fix data from https://github.com/briansrls/Robinhood-for-Google-Finance to be imported into Google Finance
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
#!/usr/bin/env python2 | |
from googlefinance import getQuotes | |
import sys | |
import csv | |
with open(sys.argv[1], 'rb') as file: | |
reader = csv.reader(file) | |
for i, row in enumerate(reader): | |
if i > 0: # skip header | |
stock = row[4] | |
try: | |
market = getQuotes(stock)[0]['Index'] | |
except Exception as e: | |
market = '[FAILED]' | |
if market not in ['NASDAQ', 'NYSE']: | |
print '{0} {1} -> {2}:{1}'.format(i, stock, market) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment