Skip to content

Commit

Permalink
Merge pull request #1867 from quantopian/remove-deprecated-yahoo-code
Browse files Browse the repository at this point in the history
MAINT: Remove deprecated Yahoo code
  • Loading branch information
freddiev4 committed Jul 5, 2017
2 parents b1e4066 + 492b22f commit bcaa7e7
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 529 deletions.
40 changes: 1 addition & 39 deletions docs/source/bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,44 +153,6 @@ Quantopian provides a mirror of the quandl WIKI dataset with the data in the
formats that zipline expects. This is available under the name:
``quantopian-quandl`` and is the default bundle for zipline.

Yahoo Bundle Factories
``````````````````````

Zipline also ships with a factory function for creating a data bundle out of a
set of tickers from yahoo: :func:`~zipline.data.bundles.yahoo_equities`.
:func:`~zipline.data.bundles.yahoo_equities` makes it easy to pre-download and
cache the data for a set of equities from yahoo. The yahoo bundles include daily
pricing data along with splits, cash dividends, and inferred asset metadata. To
create a bundle from a set of equities, add the following to your
``~/.zipline/extensions.py`` file:

.. code-block:: python
from zipline.data.bundles import register, yahoo_equities
# these are the tickers you would like data for
equities = {
'AAPL',
'MSFT',
'GOOG',
}
register(
'my-yahoo-equities-bundle', # name this whatever you like
yahoo_equities(equities),
)
This may now be used like:

.. code-block:: bash
$ zipline ingest -b my-yahoo-equities-bundle
$ zipline run -f algo.py --bundle my-yahoo-equities-bundle
More than one yahoo equities bundle may be registered as long as they use
different names.

Writing a New Bundle
~~~~~~~~~~~~~~~~~~~~

Expand All @@ -200,7 +162,7 @@ zipline. To add a new bundle, one must implement an ``ingest`` function.
The ``ingest`` function is responsible for loading the data into memory and
passing it to a set of writer objects provided by zipline to convert the data to
zipline's internal format. The ingest function may work by downloading data from
a remote location like the ``quandl`` bundle or yahoo bundles or it may just
a remote location like the ``quandl`` bundle or it may just
load files that are already on the machine. The function is provided with
writers that will write the data to the correct location transactionally. If an
ingestion fails part way through the bundle will not be written in an incomplete
Expand Down
206 changes: 0 additions & 206 deletions tests/data/bundles/test_yahoo.py

This file was deleted.

24 changes: 9 additions & 15 deletions tests/resources/rebuild_example_data
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import numpy as np
import pandas as pd

from zipline import examples
from zipline.data.bundles import clean, ingest, register, yahoo_equities
from zipline.data.bundles import clean, ingest
from zipline.testing import test_resource_path, tmp_dir
from zipline.utils.cache import dataframe_cache

Expand All @@ -30,14 +30,6 @@ INPUT_DATA_SYMBOLS = (
'AAPL',
'MSFT',
)
TEST_BUNDLE_NAME = 'test'
input_bundle = yahoo_equities(
INPUT_DATA_SYMBOLS,
INPUT_DATA_START_DATE,
INPUT_DATA_END_DATE,
)
register(TEST_BUNDLE_NAME, input_bundle)


banner = """
Please verify that the new performance is more correct than the old
Expand Down Expand Up @@ -87,18 +79,14 @@ def eof(*args, **kwargs):
raise EOFError()


def rebuild_input_data(environ):
ingest(TEST_BUNDLE_NAME, environ=environ, show_progress=True)
clean(TEST_BUNDLE_NAME, keep_last=1, environ=environ)


@click.command()
@click.option(
'--rebuild-input',
is_flag=True,
default=False,
help="Should we rebuild the input data from Yahoo?",
)

@click.pass_context
def main(ctx, rebuild_input):
"""Rebuild the perf data for test_examples
Expand All @@ -112,8 +100,14 @@ def main(ctx, rebuild_input):
# The environ here should be the same (modulo the tempdir location)
# as we use in test_examples.py.
environ = {'ZIPLINE_ROOT': d.getpath('example_data/root')}

if rebuild_input:
rebuild_input_data(environ)
raise NotImplementedError(
("We cannot rebuild input for Yahoo because of "
"changes Yahoo made to their API, so we cannot "
"use Yahoo data bundles anymore. This will be fixed in "
"a future release")
)

new_perf_path = d.getpath(
'example_data/new_perf/%s' % pd.__version__.replace('.', '-'),
Expand Down
4 changes: 0 additions & 4 deletions zipline/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from . import loader
from .loader import (
load_from_yahoo,
load_bars_from_yahoo,
load_prices_from_csv,
load_prices_from_csv_folder,
)


__all__ = [
'load_bars_from_yahoo',
'load_from_yahoo',
'load_prices_from_csv',
'load_prices_from_csv_folder',
'loader',
Expand Down
2 changes: 0 additions & 2 deletions zipline/data/bundles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
to_bundle_ingest_dirname,
unregister,
)
from .yahoo import yahoo_equities


__all__ = [
Expand All @@ -26,5 +25,4 @@
'register',
'to_bundle_ingest_dirname',
'unregister',
'yahoo_equities',
]
Loading

0 comments on commit bcaa7e7

Please sign in to comment.