README.rst
1ystockquote
2===========
3
4**Python module - fetch stock quote data from Yahoo Finance**
5
6.. image:: https://travis-ci.org/cgoldberg/ystockquote.svg?branch=master
7 :target: https://travis-ci.org/cgoldberg/ystockquote
8
9----
10
11 * Created by: Corey Goldberg (2007,2008,2013, 2016)
12 * License: GNU LGPLv2+
13 * `Dev Home <https://github.com/cgoldberg/ystockquote>`_
14 * `PyPI <https://pypi.python.org/pypi/ystockquote>`_
15
16----
17
18~~~~~~~~~~~~
19Requirements
20~~~~~~~~~~~~
21
22 Python 2.7 or Python 3.3+
23
24~~~~~~~
25Install
26~~~~~~~
27
28`ytockquote` can be installed from `PyPI <https://pypi.python.org/pypi/ystockquote>`_ with `pip <http://www.pip-installer.org/>`_::
29
30 $ pip install ystockquote
31
32You can also clone the development repo to install (requires `git <http://git-scm.com/>`_)::
33
34 $ git clone git://github.com/cgoldberg/ystockquote.git
35 $ cd ystockquote
36 $ python setup.py install
37
38To run unit tests::
39
40 $ tox
41
42~~~~~~~~~~~~~
43Example Usage
44~~~~~~~~~~~~~
45
46.. code:: python
47
48 >>> import ystockquote
49 >>> print(ystockquote.get_price_book('GOOGL'))
50 '51.18'
51 >>> print(ystockquote.get_bid_realtime('GOOGL'))
52 '904.77'
53 >>>
54
55.. code:: python
56
57 >>> import ystockquote
58 >>> from pprint import pprint
59 >>> pprint(ystockquote.get_historical_prices('GOOGL', '2013-01-03', '2013-01-08'))
60 {'2013-01-03': {'Adj Close': '723.67',
61 'Close': '723.67',
62 'High': '731.93',
63 'Low': '720.72',
64 'Open': '724.93',
65 'Volume': '2318200'},
66 '2013-01-04': {'Adj Close': '737.97',
67 'Close': '737.97',
68 'High': '741.47',
69 'Low': '727.68',
70 'Open': '729.34',
71 'Volume': '2763500'},
72 '2013-01-07': {'Adj Close': '734.75',
73 'Close': '734.75',
74 'High': '739.38',
75 'Low': '730.58',
76 'Open': '735.45',
77 'Volume': '1655700'},
78 '2013-01-08': {'Adj Close': '733.30',
79 'Close': '733.30',
80 'High': '736.30',
81 'Low': '724.43',
82 'Open': '735.54',
83 'Volume': '1676100'}}
84 >>>
85