BUG: Forward initialize args and kwargs to user-defined function.

The initialize method of TradingAlgorithm no longer accepts and
silently ignores args and kwargs, but instead forwards them
to the user-defined function referenced by self._initialize.

To avoid passing unexpected arguments to self._initialize, the
following additional adjustments are made:

 - pop 'namespace' from the kwargs supplied to TradingAlgorithm
   rather than simply get()ing it

 - do not pass an AssetFinder to the TradingAlgorithm in
   test_modelling_algo.py, as this has been deprecated and will
   cause self._initialize to fail
This commit is contained in:
Thomas Wiecki
2015-09-14 10:42:20 -04:00
committed by Stewart Douglas
parent a6e677a1d7
commit 6f2e1672d7
2 changed files with 2 additions and 5 deletions
+2 -2
View File
@@ -177,7 +177,7 @@ class TradingAlgorithm(object):
self.account_controls = []
self._recorded_vars = {}
self.namespace = kwargs.get('namespace', {})
self.namespace = kwargs.pop('namespace', {})
self._platform = kwargs.pop('platform', 'zipline')
@@ -336,7 +336,7 @@ class TradingAlgorithm(object):
functions.
"""
with ZiplineAPI(self):
self._initialize(self)
self._initialize(self, *args, **kwargs)
def before_trading_start(self, data):
if self._before_trading_start is None: