Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Python by eGlyph ( 14 years ago )
import urllib

class YStockQuote(object):
    __fields = ['price', 'change', 'volume', 'avg_daily_volume', 'stock_exchange', 
              'market_cap', 'book_value', 'ebitda', 'dividend_per_share', 
              'dividend_yield', 'earnings_per_share', '52_week_high',      
              '52_week_low', '50day_moving_avg', '200day_moving_avg', 'price_earnings_ratio', 
              'price_earnings_growth_ratio', 'price_sales_ratio', 'price_book_ratio', 'short_ratio']

    def __init__ (self, symbol):
        uri  = 'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s' % (symbol, 'l1c1va2xj1b4j4dyekjm3m4rr5p5p6s7')
        data = urllib.urlopen(uri).read().strip(' "').split(',')
        self.__dict__ = dict([(f, data[n]) for n, f in enumerate(self.__fields)])

 

Revise this Paste

Children: 17107
Your Name: Code Language: