Showing posts with label python yahoo finance stock quotes ystockquote. Show all posts
Showing posts with label python yahoo finance stock quotes ystockquote. Show all posts

Friday, December 25, 2009

How to get stock quotes and other data from yahoo finance

Code

import ystockquote #1
for item in ystockquote.get_all('goog').iteritems(): #2
print item #3


How this works - Line by Line
import ystockquote                                     #1

This imports the ystockquote module which you can get HERE

for item in ystockquote.get_all('goog').iteritems():   #2

You can change the stock ticker from 'goog' to the ticker of interest.
for example, to get yahoo's stock quote, change 'goog' to 'yhoo'
This loops through each item in the ystockquote fields

    print item                                         #3

This prints each item