Skip to main content

retrieve stock quote data from Yahoo Finance

Project description

Python module - retrieve stock quote data from Yahoo Finance


Requirements

  • Python 2.7/3.2+

Install

ytockquote can be installed from PyPI with pip:

$ pip install ystockquote

You can also clone the development repo (requires git) to install and run unit-tests:

$ git clone git://github.com/cgoldberg/ystockquote.git
$ cd ystockquote
$ python setup.py install
$ python -m unittest discover

Example Usage

>>> import ystockquote
>>> ystockquote.get_price('GOOG')
'869.33'
>>>
>>> import ystockquote
>>> from pprint import pprint
>>> pprint(ystockquote.get_historical_prices('GOOG', '2013-01-03', '2013-01-08'))
{'2013-01-03': {'Adj Close': '723.67',
                'Close': '723.67',
                'High': '731.93',
                'Low': '720.72',
                'Open': '724.93',
                'Volume': '2318200'},
 '2013-01-04': {'Adj Close': '737.97',
                'Close': '737.97',
                'High': '741.47',
                'Low': '727.68',
                'Open': '729.34',
                'Volume': '2763500'},
 '2013-01-07': {'Adj Close': '734.75',
                'Close': '734.75',
                'High': '739.38',
                'Low': '730.58',
                'Open': '735.45',
                'Volume': '1655700'},
 '2013-01-08': {'Adj Close': '733.30',
                'Close': '733.30',
                'High': '736.30',
                'Low': '724.43',
                'Open': '735.54',
                'Volume': '1676100'}}
>>>
>>> import ystockquote
>>> from pprint import pprint
>>> pprint(ystockquote.get_all('GOOG'))
{'avg_daily_volume': '2178170',
 'book_value': '236.698',
 'change': '0.00',
 'dividend_per_share': '0.00',
 'dividend_yield': 'N/A',
 'earnings_per_share': '34.565',
 'ebitda': '17.004B',
 'fifty_day_moving_avg': '894.304',
 'fifty_two_week_high': '928.00',
 'fifty_two_week_low': '636.00',
 'market_cap': '289.5B',
 'price': '869.33',
 'price_book_ratio': '3.67',
 'price_earnings_growth_ratio': '1.37',
 'price_earnings_ratio': '25.15',
 'price_sales_ratio': '5.19',
 'short_ratio': '1.70',
 'stock_exchange': '"NasdaqNM"',
 'two_hundred_day_moving_avg': '848.489',
 'volume': '3800'}
>>>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ystockquote-0.2.4.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file ystockquote-0.2.4.tar.gz.

File metadata

  • Download URL: ystockquote-0.2.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ystockquote-0.2.4.tar.gz
Algorithm Hash digest
SHA256 5d0f65bc8cb1d5c9198deae098ee7641d8a9e2203379422c07fce5900be7d8da
MD5 fc0d7c3d25eedf373761d9366c789b00
BLAKE2b-256 7124c5da5c4d5416ad98363a627128aadee3a24cbf2e20c7d5b1b1c881d83a8b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page