mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-21 12:30:16 +08:00
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:
committed by
Stewart Douglas
parent
a6e677a1d7
commit
6f2e1672d7
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user