The ystockquote module provides a Python API for retrieving stock data from Yahoo Finance.
This module contains the following functions:
- get_all(symbol)
- get_price(symbol)
- get_change(symbol)
- get_volume(symbol)
- get_avg_daily_volume(symbol)
- get_stock_exchange(symbol)
- get_market_cap(symbol)
- get_book_value(symbol)
- get_ebitda(symbol)
- get_dividend_per_share(symbol)
- get_dividend_yield(symbol)
- get_earnings_per_share(symbol)
- get_52_week_high(symbol)
- get_52_week_low(symbol)
- get_50day_moving_avg(symbol)
- get_200day_moving_avg(symbol)
- get_price_earnings_ratio(symbol)
- get_price_earnings_growth_ratio(symbol)
- get_price_sales_ratio(symbol)
- get_price_book_ratio(symbol)
- get_short_ratio(symbol)
- get_historical_prices(symbol, start_yyyymmdd, end_yyyymmdd)
Sample Usage:
>>> import ystockquote
>>> print ystockquote.get_price('GOOG')
529.46
>>> print ystockquote.get_all('MSFT')
{'stock_exchange': '"NasdaqNM"', 'market_cap': '268.6B', '200day_moving_avg': '29.2879',
'52_week_high': '31.84', 'price_earnings_growth_ratio': '1.45', 'price_sales_ratio': '5.33',
'price': '28.65', 'earnings_per_share': '1.423', '50day_moving_avg': '28.7981',
'avg_daily_volume': '55579700', 'volume': '25330856', '52_week_low': '26.48', 'short_ratio': '1.60',
'price_earnings_ratio': '28.65', 'dividend_yield': '1.38', 'dividend_per_share': '0.40',
'price_book_ratio': '8.76', 'ebitda': '20.441B', 'change': '-0.39', 'book_value': '3.315'}
http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=l1
http://finance.yahoo.com/d/quotes.csv?s=CLH13.NYM&f=l1
http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=l1
http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=l1&ignore=.csv
http://ichart.yahoo.com/table.csv?s=CLH13.NYM&f=l1&ignore=.csv
http://ichart.yahoo.com/table.csv?s=CLH13.NYM&a=0&b=1&c=2000&d=0&e=31&f=2010&g=w&ignore=.csv
http://ichart.yahoo.com/table.csv?s=GBPEUR=X&f=l1
http://ichart.finance.yahoo.com/table.csv?s=GBPEUR=X&a=01&b=19&c=2010&d=01&e=19&f=2010&g=d&ignore=.csv
http://finance.yahoo.com/q/hp?s=GBPEUR=X&a=01&b=19&c=2010&d=01&e=19&f=2010&g=d
CLH13.NYM
沒有留言:
張貼留言