Skip to content

Instantly share code, notes, and snippets.

@kpmiller
Created November 26, 2016 18:09
Show Gist options
  • Save kpmiller/607b2fe5faebb08b404a4a0439f9d610 to your computer and use it in GitHub Desktop.
Save kpmiller/607b2fe5faebb08b404a4a0439f9d610 to your computer and use it in GitHub Desktop.
Download historical stock data from yahoo
#!/usr/bin/python
import sys, os
if len(sys.argv) < 2:
print """Usage: %s symbol
where symbol is the stock symbol to fetch
""" % sys.argv[0]
sys.exit(1)
cmd = 'curl -o %s.csv http://ichart.yahoo.com/table.csv?s=%s&a=1&b=1&c=2016&d=11&e=22&f=2016' % (sys.argv[1], sys.argv[1])
print cmd
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment