mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-04 08:43:21 +08:00
ENH: Remove need to pass sid to TALib transform constructor.
Now that BatchTransforms use RollingPanels under the hood, passing an sid is no longer needed, passing the data will to handle_data will suffice.
This commit is contained in:
@@ -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(0, window_length=10),
|
||||
ta.MA(0, window_length=25)]
|
||||
zipline_transforms = [ta.MA(window_length=10),
|
||||
ta.MA(window_length=25)]
|
||||
talib_fn = talib.abstract.MA
|
||||
algo = TALIBAlgorithm(talib=zipline_transforms)
|
||||
algo.run(self.source)
|
||||
|
||||
@@ -56,8 +56,7 @@ def make_transform(talib_fn, name):
|
||||
--------
|
||||
|
||||
A moving average of a data column called 'Oil' with timeperiod 5,
|
||||
for sid 'XYZ':
|
||||
talib.transforms.ta.MA('XYZ', close='Oil', timeperiod=5)
|
||||
talib.transforms.ta.MA(close='Oil', timeperiod=5)
|
||||
|
||||
The user could find the default arguments and mappings by calling:
|
||||
help(zipline.transforms.ta.MA)
|
||||
@@ -66,8 +65,6 @@ def make_transform(talib_fn, name):
|
||||
Arguments
|
||||
---------
|
||||
|
||||
sid : zipline sid
|
||||
|
||||
open : string, default 'open'
|
||||
high : string, default 'high'
|
||||
low : string, default 'low'
|
||||
@@ -83,7 +80,6 @@ def make_transform(talib_fn, name):
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
sid,
|
||||
close='price',
|
||||
open='open',
|
||||
high='high',
|
||||
@@ -160,7 +156,6 @@ def make_transform(talib_fn, name):
|
||||
|
||||
super(TALibTransform, self).__init__(
|
||||
func=zipline_wrapper,
|
||||
sids=sid,
|
||||
refresh_period=refresh_period,
|
||||
window_length=max(1, self.lookback + 1))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user