=============
yahoo-finance
=============
Python module to get stock data from Yahoo! Finance
.. image:: https://travis-ci.org/lukaszbanasiak/yahoo-finance.svg?branch=master
:target: https://travis-ci.org/lukaszbanasiak/yahoo-finance
Yahoo! Finance backend is http://datatables.org/. If this service is down or
has network problems you will receive errors from group YQL*,
eg. ``YQLQueryError``.
You can monitor this service via https://www.datatables.org/healthchecker/
More details https://github.com/lukaszbanasiak/yahoo-finance/issues/44
Install
-------
From PyPI with pip:
.. code:: bash
$ pip install yahoo-finance
From development repo (requires git)
.. code:: bash
$ git clone git://github.com/lukaszbanasiak/yahoo-finance.git
$ cd yahoo-finance
$ python setup.py install
Usage examples
--------------
Get shares data
^^^^^^^^^^^^^^^
Example: Yahoo! Inc. (``YHOO``)
.. code:: python
>>> from yahoo_finance import Share
>>> yahoo = Share('YHOO')
>>> print yahoo.get_open()
'36.60'
>>> print yahoo.get_price()
'36.84'
>>> print yahoo.get_trade_datetime()
'2014-02-05 20:50:00 UTC+0000'
Refresh data from market
.. code:: python
>>> yahoo.refresh()
>>> print yahoo.get_price()
'36.87'
>>> print yahoo.get_trade_datetime()
'2014-02-05 21:00:00 UTC+0000'
Historical data
.. code:: python
>>> print yahoo.get_historical('2014-04-25', '2014-04-29')
[{u'Volume': u'28720000', u'Symbol': u'YHOO', u'Adj_Close': u'35.83', u'High': u'35.89', u'Low': u'34.12', u'Date': u'2014-04-29', u'Close': u'35.83', u'Open': u'34.37'}, {u'Volume': u'30422000', u'Symbol': u'YHOO', u'Adj_Close': u'33.99', u'High': u'35.00', u'Low': u'33.65', u'Date': u'2014-04-28', u'Close': u'33.99', u'Open': u'34.67'}, {u'Volume': u'19391100', u'Symbol': u'YHOO', u'Adj_Close': u'34.48', u'High': u'35.10', u'Low': u'34.29', u'Date': u'2014-04-25', u'Close': u'34.48', u'Open': u'35.03'}]
More readable output :)
.. code:: python
>>> from pprint import pprint
>>> pprint(yahoo.get_historical('2014-04-25', '2014-04-29'))
[{u'Adj_Close': u'35.83',
u'Close': u'35.83',
u'Date': u'2014-04-29',
u'High': u'35.89',
u'Low': u'34.12',
u'Open': u'34.37',
u'Symbol': u'YHOO',
u'Volume': u'28720000'},
{u'Adj_Close': u'33.99',
u'Close': u'33.99',
u'Date': u'2014-04-28',
u'High': u'35.00',
u'Low': u'33.65',
u'Open': u'34.67',
u'Symbol': u'YHOO',
u'Volume': u'30422000'},
{u'Adj_Close': u'34.48',
u'Close': u'34.48',
u'Date': u'2014-04-25',
u'High': u'35.10',
u'Low': u'34.29',
u'Open': u'35.03',
u'Symbol': u'YHOO',
u'Volume': u'19391100'}]
Available methods
- ``get_price()``
- ``get_change()``
- ``get_percent_change()``
- ``get_volume()``
- ``get_prev_close()``
- ``get_open()``
- ``get_avg_daily_volume()``
- ``get_stock_exchange()``
- ``get_market_cap()``
- ``get_book_value()``
- ``get_ebitda()``
- ``get_dividend_share()``
- ``get_dividend_yield()``
- ``get_earnings_share()``
- ``get_days_high()``
- ``get_days_low()``
- ``get_year_high()``
- ``get_year_low()``
- ``get_50day_moving_avg()``
- ``get_200day_moving_avg()``
- ``get_price_earnings_ratio()``
- ``get_price_earnings_growth_ratio()``
- ``get_price_sales()``
- ``get_price_book()``
- ``get_short_ratio()``
- ``get_trade_datetime()``
- ``get_historical(start_date, end_date)``
- ``get_info()``
- ``get_name()``
- ``refresh()``
- ``get_percent_change_from_year_high()``
- ``get_percent_change_from_year_low()``
- ``get_change_from_year_low()``
- ``get_change_from_year_high()``
- ``get_percent_change_from_200_day_moving_average()``
- ``get_change_from_200_day_moving_average()``
- ``get_percent_change_from_50_day_moving_average()``
- ``get_change_from_50_day_moving_average()``
- ``get_EPS_estimate_next_quarter()``
- ``get_EPS_estimate_next_year()``
- ``get_ex_dividend_date()``
- ``get_EPS_estimate_current_year()``
- ``get_price_EPS_estimate_next_year()``
- ``get_price_EPS_estimate_current_year()``
- ``get_one_yr_target_price()``
- ``get_change_percent_change()``
- ``get_dividend_pay_date()``
- ``get_currency()``
- ``get_last_trade_with_time()``
- ``get_days_range()``
- ``get_year_range()``
Get currency data
^^^^^^^^^^^^^^^^^
Example: EUR/PLN (``EURPLN=X``)
.. code:: python
>>> from yahoo_finance import Currency
>>> eur_pln = Currency('EURPLN')
>>> print eur_pln.get_bid()
'4.2007'
>>> print eur_pln.get_ask()
'4.2091'
>>> print eur_pln.get_rate()
'4.2049'
>>> print eur_pln.get_trade_datetime()
'2014-03-05 11:23:00 UTC+0000'
Refresh data from market
.. code:: python
>>> eur_pln.refresh()
>>> print eur_pln.get_rate()
'4.2052'
>>> print eur_pln.get_trade_datetime()
'2014-03-05 11:27:00 UTC+0000'
Avalible methods
- ``get_bid()``
- ``get_ask()``
- ``get_rate()``
- ``get_trade_datetime()``
- ``refresh()``
Requirements
------------
See ``requirements.txt``
Raw data
{
"_id": null,
"home_page": "https://github.com/lukaszbanasiak/yahoo-finance",
"name": "yahoo-finance",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "stocks market finance yahoo quotes shares currency",
"author": "Lukasz Banasiak",
"author_email": "lukasz@banasiak.me",
"download_url": "https://files.pythonhosted.org/packages/7c/8c/61e2250dd88a22a3156c2b44fd021140bf984b49800584cb0372193a116a/yahoo-finance-1.4.0.tar.gz",
"platform": "UNKNOWN",
"description": "=============\nyahoo-finance\n=============\n\nPython module to get stock data from Yahoo! Finance\n\n.. image:: https://travis-ci.org/lukaszbanasiak/yahoo-finance.svg?branch=master\n :target: https://travis-ci.org/lukaszbanasiak/yahoo-finance\n\nYahoo! Finance backend is http://datatables.org/. If this service is down or\nhas network problems you will receive errors from group YQL*,\neg. ``YQLQueryError``.\n\nYou can monitor this service via https://www.datatables.org/healthchecker/\n\nMore details https://github.com/lukaszbanasiak/yahoo-finance/issues/44\n\nInstall\n-------\n\nFrom PyPI with pip:\n\n.. code:: bash\n\n $ pip install yahoo-finance\n\nFrom development repo (requires git)\n\n.. code:: bash\n\n $ git clone git://github.com/lukaszbanasiak/yahoo-finance.git\n $ cd yahoo-finance\n $ python setup.py install\n\nUsage examples\n--------------\n\nGet shares data\n^^^^^^^^^^^^^^^\n\nExample: Yahoo! Inc. (``YHOO``)\n\n.. code:: python\n\n >>> from yahoo_finance import Share\n >>> yahoo = Share('YHOO')\n >>> print yahoo.get_open()\n '36.60'\n >>> print yahoo.get_price()\n '36.84'\n >>> print yahoo.get_trade_datetime()\n '2014-02-05 20:50:00 UTC+0000'\n\nRefresh data from market\n\n.. code:: python\n\n >>> yahoo.refresh()\n >>> print yahoo.get_price()\n '36.87'\n >>> print yahoo.get_trade_datetime()\n '2014-02-05 21:00:00 UTC+0000'\n\nHistorical data\n\n.. code:: python\n\n >>> print yahoo.get_historical('2014-04-25', '2014-04-29')\n [{u'Volume': u'28720000', u'Symbol': u'YHOO', u'Adj_Close': u'35.83', u'High': u'35.89', u'Low': u'34.12', u'Date': u'2014-04-29', u'Close': u'35.83', u'Open': u'34.37'}, {u'Volume': u'30422000', u'Symbol': u'YHOO', u'Adj_Close': u'33.99', u'High': u'35.00', u'Low': u'33.65', u'Date': u'2014-04-28', u'Close': u'33.99', u'Open': u'34.67'}, {u'Volume': u'19391100', u'Symbol': u'YHOO', u'Adj_Close': u'34.48', u'High': u'35.10', u'Low': u'34.29', u'Date': u'2014-04-25', u'Close': u'34.48', u'Open': u'35.03'}]\n\nMore readable output :)\n\n.. code:: python\n\n >>> from pprint import pprint\n >>> pprint(yahoo.get_historical('2014-04-25', '2014-04-29'))\n [{u'Adj_Close': u'35.83',\n u'Close': u'35.83',\n u'Date': u'2014-04-29',\n u'High': u'35.89',\n u'Low': u'34.12',\n u'Open': u'34.37',\n u'Symbol': u'YHOO',\n u'Volume': u'28720000'},\n {u'Adj_Close': u'33.99',\n u'Close': u'33.99',\n u'Date': u'2014-04-28',\n u'High': u'35.00',\n u'Low': u'33.65',\n u'Open': u'34.67',\n u'Symbol': u'YHOO',\n u'Volume': u'30422000'},\n {u'Adj_Close': u'34.48',\n u'Close': u'34.48',\n u'Date': u'2014-04-25',\n u'High': u'35.10',\n u'Low': u'34.29',\n u'Open': u'35.03',\n u'Symbol': u'YHOO',\n u'Volume': u'19391100'}]\n\nAvailable methods\n\n- ``get_price()``\n- ``get_change()``\n- ``get_percent_change()``\n- ``get_volume()``\n- ``get_prev_close()``\n- ``get_open()``\n- ``get_avg_daily_volume()``\n- ``get_stock_exchange()``\n- ``get_market_cap()``\n- ``get_book_value()``\n- ``get_ebitda()``\n- ``get_dividend_share()``\n- ``get_dividend_yield()``\n- ``get_earnings_share()``\n- ``get_days_high()``\n- ``get_days_low()``\n- ``get_year_high()``\n- ``get_year_low()``\n- ``get_50day_moving_avg()``\n- ``get_200day_moving_avg()``\n- ``get_price_earnings_ratio()``\n- ``get_price_earnings_growth_ratio()``\n- ``get_price_sales()``\n- ``get_price_book()``\n- ``get_short_ratio()``\n- ``get_trade_datetime()``\n- ``get_historical(start_date, end_date)``\n- ``get_info()``\n- ``get_name()``\n- ``refresh()``\n- ``get_percent_change_from_year_high()``\n- ``get_percent_change_from_year_low()``\n- ``get_change_from_year_low()``\n- ``get_change_from_year_high()``\n- ``get_percent_change_from_200_day_moving_average()``\n- ``get_change_from_200_day_moving_average()``\n- ``get_percent_change_from_50_day_moving_average()``\n- ``get_change_from_50_day_moving_average()``\n- ``get_EPS_estimate_next_quarter()``\n- ``get_EPS_estimate_next_year()``\n- ``get_ex_dividend_date()``\n- ``get_EPS_estimate_current_year()``\n- ``get_price_EPS_estimate_next_year()``\n- ``get_price_EPS_estimate_current_year()``\n- ``get_one_yr_target_price()``\n- ``get_change_percent_change()``\n- ``get_dividend_pay_date()``\n- ``get_currency()``\n- ``get_last_trade_with_time()``\n- ``get_days_range()``\n- ``get_year_range()``\n\n\n\nGet currency data\n^^^^^^^^^^^^^^^^^\n\nExample: EUR/PLN (``EURPLN=X``)\n\n.. code:: python\n\n >>> from yahoo_finance import Currency\n >>> eur_pln = Currency('EURPLN')\n >>> print eur_pln.get_bid()\n '4.2007'\n >>> print eur_pln.get_ask()\n '4.2091'\n >>> print eur_pln.get_rate()\n '4.2049'\n >>> print eur_pln.get_trade_datetime()\n '2014-03-05 11:23:00 UTC+0000'\n\nRefresh data from market\n\n.. code:: python\n\n >>> eur_pln.refresh()\n >>> print eur_pln.get_rate()\n '4.2052'\n >>> print eur_pln.get_trade_datetime()\n '2014-03-05 11:27:00 UTC+0000'\n\nAvalible methods\n\n- ``get_bid()``\n- ``get_ask()``\n- ``get_rate()``\n- ``get_trade_datetime()``\n- ``refresh()``\n\nRequirements\n------------\n\nSee ``requirements.txt``",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python module to get stock data from Yahoo! Finance",
"version": "1.4.0",
"project_urls": {
"Download": "https://github.com/lukaszbanasiak/yahoo-finance/releases",
"Homepage": "https://github.com/lukaszbanasiak/yahoo-finance"
},
"split_keywords": [
"stocks",
"market",
"finance",
"yahoo",
"quotes",
"shares",
"currency"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7c8c61e2250dd88a22a3156c2b44fd021140bf984b49800584cb0372193a116a",
"md5": "4a90466aba8679a30ef95668a6b52bce",
"sha256": "9e3619e365faa3694c95888a45a53acd9567bc749ef92f764f2d11c64a22c0b9"
},
"downloads": -1,
"filename": "yahoo-finance-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "4a90466aba8679a30ef95668a6b52bce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8875,
"upload_time": "2016-11-17T18:29:11",
"upload_time_iso_8601": "2016-11-17T18:29:11.267542Z",
"url": "https://files.pythonhosted.org/packages/7c/8c/61e2250dd88a22a3156c2b44fd021140bf984b49800584cb0372193a116a/yahoo-finance-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2016-11-17 18:29:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lukaszbanasiak",
"github_project": "yahoo-finance",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "yahoo-finance"
}