From ab0d07d8d0eaaf9256a55a64970a81dea9367a3c Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Wed, 3 Jul 2013 13:46:32 -0400 Subject: [PATCH] API: Conform timeperiad to TALib interface instead of BatchTransform's. For the creation of a TALib transform use timeperiod intsead of window_length, to be more in the style of TALib usage, since all TALib functions may not ending up using BatchTransform, so start the practice of adhering to TALib conventions to make porting and explanation easier. --- tests/test_transforms.py | 4 ++-- zipline/transforms/ta.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 7d3b7aa9..d61a9cf2 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -344,8 +344,8 @@ class TestTALIB(TestCase): # factory.create_test_panel_ohlc_source(self.sim_params) def test_multiple_talib_with_args(self): - zipline_transforms = [ta.MA(window_length=10), - ta.MA(window_length=25)] + zipline_transforms = [ta.MA(timeperiod=10), + ta.MA(timeperiod=25)] talib_fn = talib.abstract.MA algo = TALIBAlgorithm(talib=zipline_transforms) algo.run(self.source) diff --git a/zipline/transforms/ta.py b/zipline/transforms/ta.py index 700b6758..09292680 100644 --- a/zipline/transforms/ta.py +++ b/zipline/transforms/ta.py @@ -94,10 +94,10 @@ def make_transform(talib_fn, name): 'volume': volume, 'close': close} - # Rename window_length to timeperiod to conform with - # external batch_transform interface. - if 'window_length' in kwargs: - kwargs['timeperiod'] = kwargs['window_length'] + # Rename timeperiod to window_length to conform with + # TALib interface. + if 'timeperiod' in kwargs: + kwargs['window_length'] = kwargs['timeperiod'] self.call_kwargs = kwargs