From 55f154816015c53142a6fcb0f17c49c562bdd962 Mon Sep 17 00:00:00 2001 From: Joe Jevnik Date: Mon, 9 May 2016 14:00:35 -0400 Subject: [PATCH] BUG: fix inverted splits in quandl data --- tests/data/bundles/test_quandl.py | 4 ++-- zipline/data/bundles/quandl.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/data/bundles/test_quandl.py b/tests/data/bundles/test_quandl.py index 31627ae3..4e9b1f5b 100644 --- a/tests/data/bundles/test_quandl.py +++ b/tests/data/bundles/test_quandl.py @@ -162,7 +162,7 @@ class QuandlBundleTestCase(ZiplineTestCase): last_row=i(108), first_col=sids['AAPL'], last_col=sids['AAPL'], - value=7.0, + value=1.0 / 7.0, )], }, ] * (len(self.columns) - 1) + [ @@ -173,7 +173,7 @@ class QuandlBundleTestCase(ZiplineTestCase): last_row=i(108), first_col=sids['AAPL'], last_col=sids['AAPL'], - value=1 / 7, + value=7.0, )], } ] diff --git a/zipline/data/bundles/quandl.py b/zipline/data/bundles/quandl.py index 8636bc54..04c7c590 100644 --- a/zipline/data/bundles/quandl.py +++ b/zipline/data/bundles/quandl.py @@ -206,7 +206,7 @@ def fetch_single_equity(api_key, def _update_splits(splits, asset_id, raw_data): split_ratios = raw_data.split_ratio - df = pd.DataFrame({'ratio': split_ratios[split_ratios != 1]}) + df = pd.DataFrame({'ratio': 1 / split_ratios[split_ratios != 1]}) df.index.name = 'effective_date' df.reset_index(inplace=True) df['sid'] = asset_id