From 54be3858ba075d3873cbad05c08405068a61e8b7 Mon Sep 17 00:00:00 2001 From: Joe Jevnik Date: Fri, 24 Jun 2016 21:34:16 -0400 Subject: [PATCH] TST: adds test bundle to builtins to make it easier to rebuild when the asset db changes --- zipline/__main__.py | 3 +++ zipline/data/bundles/yahoo.py | 22 ++++++++++++++++++++++ zipline/utils/paths.py | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/zipline/__main__.py b/zipline/__main__.py index fba2087f..3dde2b59 100644 --- a/zipline/__main__.py +++ b/zipline/__main__.py @@ -348,6 +348,9 @@ def bundles(): """List all of the available data bundles. """ for bundle in sorted(bundles_module.bundles.keys()): + if bundle.startswith('.'): + # hide the test data + continue try: ingestions = sorted( (str(bundles_module.from_bundle_ingest_dirname(ing)) diff --git a/zipline/data/bundles/yahoo.py b/zipline/data/bundles/yahoo.py index 8a500253..db9ce298 100644 --- a/zipline/data/bundles/yahoo.py +++ b/zipline/data/bundles/yahoo.py @@ -6,6 +6,7 @@ from pandas_datareader.data import DataReader import requests from zipline.utils.cli import maybe_show_progress +from .core import register def _cachpath(symbol, type_): @@ -169,3 +170,24 @@ def yahoo_equities(symbols, start=None, end=None): adjustment_writer.write(splits=splits, dividends=dividends) return ingest + + +# bundle used when creating test data +register( + '.test', + yahoo_equities( + ( + 'AMD', + 'CERN', + 'COST', + 'DELL', + 'GPS', + 'INTC', + 'MMM', + 'AAPL', + 'MSFT', + ), + pd.Timestamp('2004-01-02', tz='utc'), + pd.Timestamp('2015-01-01', tz='utc'), + ), +) diff --git a/zipline/utils/paths.py b/zipline/utils/paths.py index 0e87d94d..160de901 100644 --- a/zipline/utils/paths.py +++ b/zipline/utils/paths.py @@ -19,7 +19,7 @@ def hidden(path): path : str A filepath. """ - return path.startswith('.') + return os.path.split(path)[1].startswith('.') def ensure_directory(path):