Skip to content

Instantly share code, notes, and snippets.

@notyal
Created August 24, 2017 17:56
Show Gist options
  • Save notyal/e6fb3261018a148b7d958dd10122f39e to your computer and use it in GitHub Desktop.
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
#!/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