Stock Historical Data
In my DB project I want to design a site for stock mining. First thing I did is writing a bot for downloading all stock historical data in Python. I really like Python it makes my life a lot easier and more effective. Unless I don’t feel I’m really live effectively!
Here is code:
import urllib2
f=open(’cusip.txt’, ‘r’)
tickers = []
for line in f:
tickers.append(line.split(’,')[0])
for t in tickers:
# Open the URL
try:
rows=urllib2.urlopen(’http://ichart.finance.yahoo.com/table.csv?’+\
’s=%s&d=09&e=05&f=2008&g=d&a=3&b=12&c=1997′%t +\
‘&ignore=.csv’).read()
t = open(t+’.csv’,'w’)
t.write(rows)
t.close()except IOError:
errors = [t]
errf = open(’bad_trickers.txt’,'w’)
errf.write(str(errors))
errf.close()
f.close()
print errorsClick here to download!
November 17th, 2008 at 10:45 pm
After rain comes fair weather
November 21st, 2008 at 11:09 am
Last night I was having dinner with Charles Manson, and in the middle of dinner he turned to me and said “Is it hot in here, or am I crazy?” (Gilbert Gottfried)
December 12th, 2008 at 8:13 pm
Add to my Bookmarks
February 7th, 2009 at 4:27 am
blog.digvan.com - great domain name for blog like this)))
————————
ad: http://qugor.ru
February 7th, 2009 at 7:11 am
blog.digvan.com - cool sitename man)))
————————
internet signature: http://youraudiovox.com/music13/map.html
February 10th, 2009 at 6:58 am
blog.digvan.com - cooooolest domain name)))
————————
internet signature: http://lilid.ru/
February 10th, 2009 at 8:32 am
blog.digvan.com - cool sitename man)))
————————
ads: http://lilid.ru/
February 10th, 2009 at 5:47 pm
Hello, I can’t understand how to add your blog ( blog.digvan.com ) in my rss reader
————————
signature: http://zehon.ru/
February 10th, 2009 at 7:17 pm
blog.digvan.com - great domain name for blog like this)))
————————
sponsored link: http://zehon.ru/
February 11th, 2009 at 3:28 am
blog.digvan.com - now in my rss reader)))
————————
sponsor: http://vahar.ru/
February 11th, 2009 at 5:38 pm
Hello, I can’t understand how to add your blog ( blog.digvan.com ) in my rss reader
————————
internet signature: http://cexiq.ru/
February 13th, 2009 at 1:39 pm
blog.digvan.com - cool sitename man)))
————————
my blog: http://hixoh.ru/
February 13th, 2009 at 3:17 pm
blog.digvan.com - great domain name for blog like this)))
————————
ads: http://hixoh.ru/
May 1st, 2009 at 4:58 pm
Great site, Good info
May 12th, 2009 at 1:14 pm
Very interesting site, Hope it will always be alive!
June 4th, 2009 at 2:29 pm
I really liked this post. Can I copy it to my site? Thank you in advance.
June 12th, 2009 at 3:10 pm
Great post! I’ll subscribe right now wth my feedreader software!
June 13th, 2009 at 6:47 pm
Hi, gr8 post thanks for posting. Information is useful!
June 15th, 2009 at 11:56 am
Hi, very nice post. I have been wonder’n bout this issue,so thanks for posting
June 16th, 2009 at 3:51 pm
You know so many interesting infomation. You might be very wise. I like such people. Don’t top writing.
September 8th, 2009 at 11:19 am
I bookmarked this link. Thank you for good job
September 8th, 2009 at 9:27 pm
Thanks!!
September 10th, 2009 at 12:17 pm
Thank you lol I’ve been searching for this everywhere >_<