Benny- / Yahoo-ticker-symbol-downloader

A web scraper for ticker symbols from yahoo finance
https://pypi.python.org/pypi/Yahoo-ticker-downloader/
Other
247 stars 87 forks source link
exchange-web-services finance python yahoo-finance-api

Yahoo ticker downloader

Produces .csv, .xlsx, .json and .yaml files (All files contain same data but in a different format) for stocks, ETF, futures, indexes, mutual funds, currency, warrants and bonds. The ticker symbol, company name and exchange are saved for all symbols.

It gets its data from https://finance.yahoo.com/lookup/_. Please note: it is not possible to get all the symbols due to limitations set by Yahoo.

Requirements

Python 2.7 or Python 3.5+

Install

From python package manager (preferred):

.. code:: bash

pip install Yahoo-ticker-downloader

From source:

.. code:: bash

python setup.py install

Example Usage

.. code::

usage: YahooTickerDownloader.py [-h] [-i] [-e] [-E EXCHANGE] [-s SLEEP] [-p]
                                [type]

positional arguments:
  type                  The type to download, this can be: generic

optional arguments:
  -h, --help            show this help message and exit
  -i, --insecure        use HTTP instead of HTTPS
  -e, --export          export immediately without downloading (Only useful if
                        you already downloaded something to the .pickle file)
  -E EXCHANGE, --Exchange EXCHANGE
                        Only export ticker symbols from this exchange (the
                        filtering is done during the export phase)
  -s SLEEP, --sleep SLEEP
                        The time to sleep in seconds between requests
  -p, --pandantic       Stop and warn the user if some rare assertion fails

For example to download all stock symbols you run it like:

.. code:: bash

YahooTickerDownloader.py

The program takes a few weeks before it is finished. The program supports suspending and resuming a download. Press CTRL+C to suspend download. Restart the program in the same working directory to resume downloading. It is possible to export partially downloaded results using the -e flag.

Example of CSV output:

.. code::

Ticker  Name    Exchange    exchangeDisplay Type    TypeDisplay
JNUG    Direxion Daily Jr Gld Mnrs Bull 3X ETF  ASE NYSE MKT    E   ETF
DWDP    DowDuPont Inc.  NYQ NYSE    S   Equity
E   Eni S.p.A.  NYQ NYSE    S   Equity
EQH AXA Equitable Holdings, Inc.    NYS NYSE    S   Equity
XOM Exxon Mobil Corporation NYQ NYSE    S   Equity
ETP Energy Transfer Partners, L.P.  NYQ NYSE    S   Equity
ES=F    E-mini S&P 500 Index Futures,Jufuture   CME Chicago Mercantile Exchange F   Futures
NQ=F    E-mini Nasdaq 100 Index Futuresfuture   CME Chicago Mercantile Exchange F   Futures
GE=F    Eurodollar Futures,Sep-2018future   CME Chicago Mercantile Exchange F   Futures
...ect

Depending on the type you are downloading, you will get between 3.000 and 100.000+ entries.

Further resources

Download history for symbols: ystockquote_

Changelog

.. _https://finance.yahoo.com/lookup/: https://finance.yahoo.com/lookup/ .. _ystockquote: https://pypi.python.org/pypi/ystockquote/